|
@ -4,9 +4,9 @@ from time import sleep |
|
|
import socketio |
|
|
import socketio |
|
|
|
|
|
|
|
|
sio = socketio.Client() |
|
|
sio = socketio.Client() |
|
|
now = datetime.now() |
|
|
now = datetime.now()#module gia wra |
|
|
|
|
|
|
|
|
ser = serial.Serial('/dev/ttyACM0', 9600, timeout=1) |
|
|
ser = serial.Serial('/dev/ttyACM0', 9600, timeout=1)#diavasma portas kai ruthmisi sundesis |
|
|
ser.flush() |
|
|
ser.flush() |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -18,15 +18,13 @@ def connect(): |
|
|
flag = 0 |
|
|
flag = 0 |
|
|
while True: |
|
|
while True: |
|
|
if flag != 1: |
|
|
if flag != 1: |
|
|
sio.connect('http://localhost:5000/') |
|
|
sio.connect('http://localhost:5000/')#connect sto server |
|
|
flag += 1 |
|
|
flag += 1 |
|
|
if ser.in_waiting > 0: |
|
|
if ser.in_waiting > 0: |
|
|
data = ser.readline().decode('utf-8').rstrip() |
|
|
data = ser.readline().decode('utf-8').rstrip() #diavasma apotelesmatos arduino |
|
|
print(data) |
|
|
print(data) |
|
|
sio.emit('data', data) |
|
|
sio.emit('data', data)#stelnei ta dedomena na emfanistoun sto server |
|
|
print(now.strftime("%Y-%m-%d %H:%M")) |
|
|
print(now.strftime("%Y-%m-%d %H:%M"))#ektuposi oras meta tin thermokrasia |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|