I have rs485 connected to my esp8266 to ports tx=D6 and rx=D5, but I can't figure a way to establish UART communication. Any help would be appreciated!
My code:
Code: Select all
from machine import Pin, UART
#D6 - TXD (12)
#D5 - RXD (14)
def test():
#modbus = UART(1, 9600)
modbus = UART(1, baudrate=9600)
modbus.init(tx=Pin(12), rx=Pin(14))
print("modbus: {}".format(modbus))
Code: Select all
Traceback (most recent call last):
File "main.py", line 30, in <module>
File "modbusComs.py", line 10, in test
ValueError: invalid tx/rx
Code: Select all
modbus.init(tx=Pin(12), rx=Pin(14))