Wake up alarm with MRPi1 robot. The robot stops the alarm automaticly when the robot detects the light.
Python program :
# import mrpi1 lib from mrpi1_lib import * import time try: while 1: al1 = ambiantLight(1) # read ambiant light,sensor 1 al2 = ambiantLight(2) al3 = ambiantLight(3) al4 = ambiantLight(4) al5 = ambiantLight(5) al6 = ambiantLight(6) print "Ambiant light = %d %d %d %d %d %d" %(al1, al2, al3, al4, al5, al6) if (al1 < 4000 and al2 < 4000): # light detects print "end alarm" writeCommand("SPD")# disable speaker exit() else: playWav("alarmClock.wav") # play alarm wav file time.sleep(0.2) except: writeCommand("SPD") # disable speaker exit()