program will let you know if arduino disconnected
This commit is contained in:
@@ -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")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user