Upload files to ''
This commit is contained in:
parent
a58f4ba93a
commit
7355c332c4
|
@ -0,0 +1,20 @@
|
|||
import serial
|
||||
import time
|
||||
ser = serial.Serial('/dev/ttyACM0', 9600)
|
||||
|
||||
html = '<meta name="viewport" content="width=device-width, initial-scale=1.0">\nThe office is currently '
|
||||
|
||||
data = ser.readline()
|
||||
if data:
|
||||
l = float(data.split("=")[1].strip())
|
||||
if l > 1:
|
||||
html += "open."
|
||||
else:
|
||||
html += "closed."
|
||||
html += "<br>Updated At: " + time.strftime('%l:%M%p %Z on %b %d, %Y')
|
||||
|
||||
with open('/users/n3parikh/www/office-status.html', 'w') as f:
|
||||
f.write(html)
|
||||
else:
|
||||
# TODO: print to log instead.
|
||||
print("error")
|
Loading…
Reference in New Issue