Skip to content
Snippets Groups Projects
Commit 431e9356 authored by Lennard's avatar Lennard
Browse files

Fix #1

parent 7a3a521b
No related branches found
Tags
No related merge requests found
"""Return the id of the arduino connected to the first serial port. id 0 is for Temperaturmessung, id 1 for DMSMessung
"""
import time
import serial
if __name__ == "__main__":
with serial.Serial("/dev/ttyACM0", 9600, timeout=3) as con:
while True:
con.write(1)
try:
print(int(con.readline().decode("utf-8")))
break
except (TypeError, ValueError):
time.sleep(1)
...@@ -4,9 +4,19 @@ cd `dirname "$0"`/../sketches ...@@ -4,9 +4,19 @@ cd `dirname "$0"`/../sketches
fqbn=arduino:avr:nano fqbn=arduino:avr:nano
core=arduino:avr core=arduino:avr
id=$(python3 ../scripts/serial_id.py)
if [[ $id != "0" ]]
then
serial_dms=/dev/ttyACM0 serial_dms=/dev/ttyACM0
serial_temp=/dev/ttyACM1 serial_temp=/dev/ttyACM1
else
serial_temp=/dev/ttyACM0
serial_dms=/dev/ttyACM1
fi
echo -e "Info: DMS arduino: $serial_dms, Temp arduino: $serial_temp"
echo "Checking connected devices..." echo "Checking connected devices..."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment