Commit 388044391fb66870a3b5023ed19bf06d3bc1797e

Authored by grouille
1 parent e62147c9

MAJ Python

Showing 1 changed file with 3 additions and 4 deletions   Show diff stats
site/fichiersRPI/Rpi_to_server.py
... ... @@ -19,16 +19,15 @@ file = open("ip_address.txt", 'r')
19 19 ip_address = file.readline()
20 20 ip_address = file.readline()[:-1]
21 21  
22   -num_capteur = int(os.path.abspath(".")[-1])
  22 +num_capteur = int(os.path.abspath(".")[-3])
23 23  
24 24 ser = serial.Serial("/dev/ttyACM0", 9600, timeout=1)
25 25 value = ser.readline()
26   -print(value)
27   -while (value in ['\r', ' ', '\n', "b''"]):
  26 +
  27 +while (value in ['\r', '', '\n', "b''"]):
28 28 value = ser.readline()
29 29 data = str(float(value[0:4]))
30 30  
31 31 params = {"ip_address": ip_address, "numero": num_capteur, "data": data, "date": date}
32 32 r = requests.post("http://projet-p10.plil.fr/IMA3_P10/site/requests.php", data = params)
33 33 print(data)
34   -print(num_capteur)
... ...