我正在与Ubilinux的英特尔Edison和Mini Breakout Board合作开展项目,并在尝试推荐时:python uart.py我得到:
root@ubilinux:~# python uart.py
Traceback (most recent call last):
File "uart.py", line 7, in <module>
u.setBaudRate(115200)
File "/usr/local/lib/i386-linux-gnu/python2.7/site-packages/mraa.py", line 1355, in <lambda>
__getattr__ = lambda self, name: _swig_getattr(self, Uart, name)
File "/usr/local/lib/i386-linux-gnu/python2.7/site-packages/mraa.py", line 78, in _swig_getattr
return _swig_getattr_nondynamic(self, class_type, name, 0)
File "/usr/local/lib/i386-linux-gnu/python2.7/site-packages/mraa.py", line 73, in _swig_getattr_nondynamic
return object.__getattr__(self, name)
AttributeError: type object 'object' has no attribute '__getattr__'
这是Python代码:
import mraa
# Initialize UART
u=mraa.Uart(0)
# Set UART parameters
u.setBaudRate(115200)
u.setMode(8, mraa.UART_PARITY_NONE, 1)
u.setFlowcontrol(False, False)
# Start a neverending loop waiting for data to arrive.
# Press Ctrl+C to get out of it.
while True:
if u.dataAvailable():
# We are doing 1-byte reads here
data_byte = u.readStr(1)
print(data_byte)
# Just a two-way half-duplex communication example, "X" is a flag
if data_byte == "X":
u.writeStr("Yes, master!")
有人可以帮我解决这个问题吗?
提前致谢