When/why did UART.send become UART.write?
Posted: Mon Feb 16, 2015 11:42 pm
Was having some trouble sending data to an lcd today because of the AttributeError: 'UART' object has no attribute 'send'. Thinking that I'd screwed something up, it took me a long while to finally think to check a dir of the object I'd created:
>>> import pyb
>>> from pyb import UART
>>> lcd = UART(6,9600)
>>> lcd.send('ready')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'UART' object has no attribute 'send'
>>> dir(lcd)
['init', 'deinit', 'any', 'read', 'readall', 'readline', 'readinto', 'write', 'writechar', 'readchar', 'sendbreak', 'RTS', 'CTS']
>>> lcd.write('test')
4
As you can see, it truly has no "send' attribute, and now (Mysteriously) has a "write" attribute. But the UART docs still say that 'send' exists, and works. What's up with this?
>>> import pyb
>>> from pyb import UART
>>> lcd = UART(6,9600)
>>> lcd.send('ready')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'UART' object has no attribute 'send'
>>> dir(lcd)
['init', 'deinit', 'any', 'read', 'readall', 'readline', 'readinto', 'write', 'writechar', 'readchar', 'sendbreak', 'RTS', 'CTS']
>>> lcd.write('test')
4
As you can see, it truly has no "send' attribute, and now (Mysteriously) has a "write" attribute. But the UART docs still say that 'send' exists, and works. What's up with this?