program will let you know if arduino disconnected
This commit is contained in:
parent
d0196b4a31
commit
c42864e46d
1 changed files with 5 additions and 3 deletions
|
|
@ -87,7 +87,7 @@ while connectedWebSocket == False:
|
||||||
|
|
||||||
while connectedArduino == False:
|
while connectedArduino == False:
|
||||||
try:
|
try:
|
||||||
toPi=serial.Serial(SERIAL_PORT,115200) #connect to arduino
|
toPi=serial.Serial(SERIAL_PORT,115200,timeout=2) #connect to arduino
|
||||||
connectedArduino = True
|
connectedArduino = True
|
||||||
except:
|
except:
|
||||||
print("please check connection to arduino and verify the correct serial port")
|
print("please check connection to arduino and verify the correct serial port")
|
||||||
|
|
@ -115,6 +115,8 @@ while True:
|
||||||
if csvOut == True:
|
if csvOut == True:
|
||||||
csvWriteOut(firstRun,carData,csvFile)
|
csvWriteOut(firstRun,carData,csvFile)
|
||||||
firstRun=False
|
firstRun=False
|
||||||
|
try:
|
||||||
toPi.write(str(kmh).encode()+":".encode())
|
toPi.write(str(kmh).encode()+":".encode())
|
||||||
|
except:
|
||||||
|
print("arduino disconnected please check connection\n")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue