This example of analog output uses a buzzer to generate the sound of the police siren, the morning alarm and a timer. The circuit can be managed from the Internet via alarm, stop, timer and snooze commands.
Connect the buzzer as shown in figure 1:
The long PIN is positive.
Write a sketch K to define:
sound :: d2 beep = [sound=6,sound=0 ##1] alarm = [beep #2] snooze = [beep #0,alarm ##5] stop = [sound=0] timer = [alarm ##10] or simply load the sketch with the command
] load e09_wake_upUsing the sound command we will create the sound of the police siren, the morning alarm and a timer.
Try the following commands now:
] sound=6the buzzer emits an infinite sequence of beeps
] sound=440the buzzer sounds the note LA
] sound=699the buzzer sounds the note FA
] police = [sound=440 #2,sound=699 #2 ##1]] policeto create the sound of the police siren
] stopto turn off the sound
] beepgenerates a beep burst for a second
] alarmgenerates the alarm clock to wake you up every morning
] snoozeto continue sleeping for another 5 seconds
] stopto turn off the alarm
] timersets a 10-second timer (wait for 10 seconds to hear the alarm)
] stopto turn off the timer.
In this lesson you learned or repeated: