mirror of
https://github.com/PotentiaRobotics/engine-software.git
synced 2025-04-17 18:40:18 -04:00
Merge Pi<->Arduino and Gui<->Pi
This commit is contained in:
parent
35548a5a5b
commit
f93a2fff46
|
@ -5,7 +5,7 @@ import serial
|
||||||
import time
|
import time
|
||||||
|
|
||||||
ser = serial.Serial('/dev/ttyACM0', 9600, timeout=2)
|
ser = serial.Serial('/dev/ttyACM0', 9600, timeout=2)
|
||||||
|
ser.flush()
|
||||||
|
|
||||||
host = '0.0.0.0'
|
host = '0.0.0.0'
|
||||||
port = 2345
|
port = 2345
|
||||||
|
@ -19,17 +19,14 @@ while True:
|
||||||
|
|
||||||
print("received data:", data)
|
print("received data:", data)
|
||||||
# Get rid of garbage/incomplete data
|
# Get rid of garbage/incomplete data
|
||||||
ser.flush()
|
|
||||||
|
|
||||||
# Infinite loop
|
# Infinite loop
|
||||||
i = 0
|
|
||||||
while (1):
|
|
||||||
i += 1
|
|
||||||
send_string = ("Data\n")
|
|
||||||
ser.write(send_string.encode('utf-8'))
|
|
||||||
time.sleep(0.01)
|
|
||||||
receive_string = ser.readline().decode('utf-8').rstrip()
|
|
||||||
print(receive_string)
|
|
||||||
|
|
||||||
conn.send(data)
|
ser.write(data)
|
||||||
|
time.sleep(0.01)
|
||||||
|
receive_string = ser.readline().decode('utf-8').rstrip()
|
||||||
|
print(receive_string)
|
||||||
|
|
||||||
|
conn.send(receive_string.encode())
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user