arduino-fridge-powercontrol/main.py

22 lines
398 B
Python
Executable file

#!/bin/python3
import serial
import time
ser = serial.Serial('/dev/ttyACM0', baudrate = 9600, timeout = 1)
time.sleep(3)
def getValues():
#ser.write(b'g')
lol = "g"
ser.write(str(lol).encode('ascii'))
arduinoData = ser.readline().decode('ascii')
return arduinoData
while 1:
userInput = input('Get data point?')
if userInput == 'y':
print(getValues())