I can not understand how to read a different number of characters from the serial
.
Tried to use this code:
import serial import time port = serial.Serial(port = "/dev/ttyAMA0", baudrate = 115200) def serial_read(): cde = 't\r' port.write(cde.encode('ascii')) print port.read('кол-во символов')
if the number of characters / letters in the word " Привет
" = 6, and in print port.read()
we entered 6
, then we will read them all, if 5
, then only 5
letters, if 7
, then Python is waiting for an additional character / letters. How to force Python
to count them by itself.