Successfully Added To Cart

EXERCISE SOLUTIONS:

Challenge

Using the setChars("text") function, we can set the seven segment display to show any four character string we want! An example of how to display a message once every hour is included in the "Alarm Clock Programs" download above.

Question 1

By adding delay(30); to the last line of the loop() function, the entire program gets slowed down enough to see how the seven segment display lights up each segment individually.

Question 2

To add a second alarm, we have to add a new String called alarm2 which is set to whatever time we want the second alarm to go off. Next, all we have to do is check if the current time is equal to alarm or alarm2. An example of how to do this is included in the "Alarm Clock Programs" download above.

Question 3

We can add a short chime each hour by just checking if the minute and second variables are 0, and that the hour variable is within a certain range. In the "Alarm Clock Programs" download, we check that the time is 9am-9pm. Then we pulse the buzzer to make the chime sound. Because loop() runs many times a second, this if statement will run multiple times when the minute and second variables are 0. This is not what we want, so we can add a boolean variable to make sure it only runs once per hour. You can see how this is done in the download above.

Google Tracking
Pinterest Tracking