Hello,
My project is more important but to summarize the problem here is the data.
board : Heltec wifi kit 32
MicroPython v1.9.4-660-g5f7088f84 on 2018-10-18; ESP32 module with ESP32
from machine import UART
uart = UART(2, 9600)
uart.init(9600, bits=8, parity=0, stop=1,tx=17,rx=5)
# until no problem
>>> a=chr(127)
>>> b=chr(128)
>>> len(a)
1
>>> len(b)
1
>>> uart.write(a)
1
>>> uart.write(b)
2
>>>
Beyond 127 the write command sends 2 bytes ...
If we look at the documentation this should only happen for a 9-bit configuration.
Do you have solutions, thank you for your answers.
Esp32 uart write 8bits
Re: Esp32 uart write 8bits
It is a problem of data types, not of the UART. chr(128) creates a string object, which is considered containing an unicode character.
try:
a = b"\x7f"
b = b"\x80"
try:
a = b"\x7f"
b = b"\x80"
Re: Esp32 uart write 8bits
Thank you I started to have no hair,
it is the len () function which is misleading.
it is the len () function which is misleading.