my esp8266 NodeMCU
UART 0 baudrate 9600 not working
Code: Select all
from machine import UART
uart = UART(0, 9600)
Code: Select all
from machine import UART
uart = UART(0, 9600)
Code: Select all
from machine import UART
import uos
def connect_to_UART(baudrate=9600):
uos.dupterm(None,1)
return UART(0,baudrate,timeout=5000)
def REPL_restore():
uart = connect_to_UART(baudrate=115200)
uos.dupterm(uart,1)
uart = connect_to_UART()
c=''
while True:
while not uart.any():
pass
c = uart.read(1)
#provide escape route to restore REPL
if 'x' in c:
REPL_restore()
break
uart.write(c)