Forum Posts

Debasish Panda
Apr 16, 2021
In RB-i.MX 6UL
import mraa # x is your i2c bus instance........... # 0x50 is the i2c client............... x = mraa.I2c(0) x.address(0x50) reg = int(input("read the register from: ")) d = x.readReg(reg) print("stored data is: " + str(d)) Able to store a value in eeprom using write command but unable to read that. While executing the code getting the error.... root@rb-imx6ul:~# python3 read_eeprom read the register from: 51 Traceback (most recent call last): File "read_eeprom", line 10, in <module> d = x.readReg(reg) File "/usr/lib/python3.5/site-packages/mraa.py", line 549, in readReg return _mraa.I2c_readReg(self, reg) ValueError: Unknown error in I2c::readReg() why this error please let me know....???
0
0
29
Debasish Panda
Dec 08, 2020
In RB-i.MX 6UL
import time import serial ser = serial.Serial( port='/dev/ttyUSB0', baudrate=115200, parity=serial.PARITY_ODD, stopbits=serial.STOPBITS_TWO, bytesize=serial.SEVENBITS ) ser.isOpen() print ('Enter your commands below.\r\nInsert "exit" to leave the application.') input=1 while 1 : input = raw_input(">> ") if input == 'exit': ser.close() exit() else: ser.write(input + '\r\n') out = '' time.sleep(1) while ser.inWaiting() > 0: out += ser.read(1) if out != '': print( ">>" + out) ~ root@rb-imx6ul:~# python3 diesel.py Traceback (most recent call last): File "diesel.py", line 2, in <module> import serial File "/home/root/serial.py", line 4, in <module> ser = serial.Serial( AttributeError: module 'serial' has no attribute 'Serial'
0
4
51