In this example, you will learn how to create a Python program to set the alarm for a particular time.
Python Program for Wake-up Alarm
The following Python program will create a wake-up alarm. Change the alarm.wav file with your sound file name.
import time import snaps current_time = time.localtime() hour = current_time.tm_hour minute = current_time.tm_min if (hour>7) or (hour==7 and minute>29): snaps.display_message('Wake-Up') snaps.play_sound('./alarm.wav') # pause the program for a while time.sleep(10)
Leave a comment