Python serial


# motor controller

import serial
import time
ser = serial.Serial('/dev/ttyUSB0',9600) # open serial port

print(ser.name) # check which port was really used
time.sleep(4)
ser.write(b'00') # write a string 09 ->fast forward
a=ser.read
print(a)
time.sleep(2)
ser.close() # close port

# read  8266

import serial
import time
ser = serial.Serial('/dev/ttyUSB1',115200) # open serial port

print(ser.name) # check which port was really used
#time.sleep(4)
#ser.write(b'00') # write a string 09 ->fast forward
while True:
a=ser.read()
print(a)
time.sleep(1)
#ser.close() # close port

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert