Sen0465 micropython missing termios module

userHead prbonin 2024-10-13 17:06:01 115 Views2 Replies

I'm trying to get a Sen0465 O2 sensor to work on a Raspberry Pi Pico W. When I try to import DFRobot_MultiGasSensor I get ImportError: no module named ‘termios' error and I can't seem to be able find the module with Thonny. Is there a micropython version of this module I should be using or is there some other work around?  

2024-10-13 20:38:31

I think my issue is that serial and smbus references need to be replaced with micropython's UART and I2C classes. The following function:

 

def __init__(self ,bus ,Baud):
   if bus != 0:
     self.i2cbus = smbus.SMBus(bus)
     self.__uart_i2c = I2C_MODE
   else:
     self.ser = serial.Serial("/dev/ttyAMA0" ,baudrate=Baud,stopbits=1)
     self.__uart_i2c = UART_MODE
     if self.ser.isOpen == False:
       self.ser.open()

 

is the only place where the problem modules are called so I'm goin to replace them with regular micropython initializations. I think that I can remove all UART references since I won't be using it.

 

 

userHeadPic prbonin
prbonin wrote:

btw the micropython termios package doesn't have anything useful in it. If I can get rid of the serial and smbus modules the original question becomes moot.

2024-10-13 20:41:06
1 Replies