I'm starting off with my RPI alarm clock, now I managed to make a button execute a shell-script that terminates my alarm. I'm looking of buying a toggling-switch
now the script I'd really like is.
if pin = 1
then = "write to status.txt : awake
if pin = 0
then = "write to status.txt : sleeping
with open('status.txt', 'w') as status: if pin == 1: status.write('awake') elif pin == 0: status.write('sleeping')
pin could ever potentially be anything else you may want to avoid opening the file unnecessarily.
if pin in [0, 1]: with open( …