Commit b910c30656c1452d9bc14096cddbfe97356caee6
1 parent
cab273d9
MAJ Script Python
Showing
2 changed files
with
9 additions
and
6 deletions
Show diff stats
site/fichiersRPI/Rpi_to_server.py
@@ -24,8 +24,9 @@ num_capteur = int(os.path.abspath(".")[-3]) | @@ -24,8 +24,9 @@ num_capteur = int(os.path.abspath(".")[-3]) | ||
24 | ser = serial.Serial("/dev/ttyACM0", 9600, timeout=1) | 24 | ser = serial.Serial("/dev/ttyACM0", 9600, timeout=1) |
25 | value = ser.readline() | 25 | value = ser.readline() |
26 | 26 | ||
27 | -while (value in ['\r', '', '\n', "b''"]): | 27 | +while (ser.inWaiting()==0): |
28 | value = ser.readline() | 28 | value = ser.readline() |
29 | + | ||
29 | data = str(float(value[0:4])) | 30 | data = str(float(value[0:4])) |
30 | 31 | ||
31 | params = {"ip_address": ip_address, "numero": num_capteur, "data": data, "date": date} | 32 | params = {"ip_address": ip_address, "numero": num_capteur, "data": data, "date": date} |
site/fichiersRPI/script.sh
@@ -3,8 +3,10 @@ | @@ -3,8 +3,10 @@ | ||
3 | echo $$ > /var/run/script.pid | 3 | echo $$ > /var/run/script.pid |
4 | 4 | ||
5 | ./load.sh | 5 | ./load.sh |
6 | -while true | ||
7 | -do | ||
8 | - sleep 5 | ||
9 | - python3 Rpi_to_server.py | ||
10 | -done | 6 | +python3 Rpi_to_server.py |
7 | + | ||
8 | +#while true | ||
9 | +#do | ||
10 | +# sleep 5 | ||
11 | +# python3 Rpi_to_server.py | ||
12 | +#done |