Skip to content

Instantly share code, notes, and snippets.

@git2samus
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save git2samus/47c184274161038eefa2 to your computer and use it in GitHub Desktop.

Select an option

Save git2samus/47c184274161038eefa2 to your computer and use it in GitHub Desktop.
from datetime import datetime, timedelta
last_seen = datetime.now()
while True:
serial_input = raw_input() # read from serial port
if serial_input == "[FIT]":
last_seen = datetime.now()
elif datetime.now() - last_seen >= timedelta(minutes=5):
print("reboot") # write to serial port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment