-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
31 lines (24 loc) · 861 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import serial
portDD = '/dev/ttyUSB2'
portBot = '/dev/ttyUSB0'
serDD = serial.Serial(port=portDD,
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
serBot = serial.Serial(port=portBot,
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
serDD.isOpen()
serBot.isOpen()
while serDD:
incoming = serDD.read()
print (f'DD {incoming}')
serBot.write(incoming)
print(f'sent {incoming} to Bot')