uart of esp8266 and uos.dupterm

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
hwt9520
Posts: 2
Joined: Sun Dec 16, 2018 9:28 pm

uart of esp8266 and uos.dupterm

Post by hwt9520 » Sun Dec 16, 2018 9:44 pm

esp8266 d1 mini
for sensor which use uart only
I have opened webrepl and is using it
the code is here:

from machine import UART
import uos,time

>>> uos.dupterm(None,1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid dupterm index
>>>

the same when input :
uos.dupterm(UART(0,115200),1)
uos.dupterm(UART(0,9600),1)


and :
uos.dupterm(UART(0,115200),0)
uos.dupterm(UART(0,9600),0)
have nothing, no working, need reboot

and :
uos.dupterm(None)
uos.dupterm(UART(0,9600))
uos.dupterm(UART(0,115200))
____________________

the main.py is here:

from machine import UART
import uos,time
#uos.dupterm(None)
u=UART(0,9600)
u.init(9600, bits=8, parity=None, stop=1)
u.write(b'0x61 0x02 0x01')
while 1:
if u.any():
from machine import Pin,PWM
pwm2=PWM(Pin(2))
pwm2.freq(1)
pwm2.duty(512)
pwm2.deinit()
print(u.read())
time.sleep(10)
u.write(b'0x610x020x01')
#uos.dupterm(UART(0,9600), 1)

Post Reply