Skip to content

Instantly share code, notes, and snippets.

@traverseda
Created June 7, 2018 14:12
Show Gist options
  • Save traverseda/4e0732c155b4c4f46532734e67e8fc6b to your computer and use it in GitHub Desktop.
Save traverseda/4e0732c155b4c4f46532734e67e8fc6b to your computer and use it in GitHub Desktop.
A termux cuckoo clock for android
#!/data/data/com.termux/files/usr/bin/python
import schedule, time, datetime
import os
def alarm():
print(datetime.datetime.now())
os.system("termux-vibrate -d 500 -f")
def hourAlarm():
print(datetime.datetime.now())
os.system("termux-vibrate -d 1000 -f")
schedule.every(15).minutes.do(alarm)
schedule.every().hour.do(hourAlarm)
while 1:
schedule.run_pending()
time.sleep(1)
@traverseda
Copy link
Author

Surprisingly, it doesn't seem to eat battery life. One annoyance is that termux-vibrate doesn't let us send very complicated signals. Another annoyance is that it's no on the hour, it's once an hour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment