1
SKILL
LEVEL
Ringo Educational Guide Rev04.1 ~ Plum Geek
Playing Note Pitches:
If you want Ringo to play a song, you can tell him to play specific notes. Look at
the tabs across the top of the Arduino IDE (or click the little down arrow at the end
of the tabs if you can’t see them all) and select the tab called “Pitches.h”. This file
“defines” each piano key note to the corresponding pitch in hertz. The “middle C”
key of the keyboard is defined as “NOTE_C4”. Let’s make Ringo play middle C. Go
back to the main tab in the Arduino IDE (the one on the far left) and try this code.
Like this:
Playing Sweeps:
You can “sweep” between tones to create interesting effects. Like this:
Ringo should be playing the C-Major chord every second. If you work with the notes
and timings it is possible to make Ringo play simple songs.
void loop(){
PlayChirp(NOTE_C6, 50);
//start playing the pitch for middle C
delay(333);
//wait about 1/3 of a second
PlayChirp(NOTE_E6, 50);
//start playing the pitch for E
delay(333);
//wait about 1/3 of a second
PlayChirp(NOTE_G6, 50);
//start playing the pitch of G
delay(333);
//wait about 1/3 of a second
OffChirp();
//stop making sound
delay(1000);
//wait 1 second before looping
}
//PlaySweep(Start_Note, End_Note, Dwell_Time); //dwell time is in microseconds
void loop(){
PlaySweep(1000, 4000, 330);
delay(500);
//wait 1/2 second
PlaySweep(4000, 1000, 330);
delay(500);
//wait 1/2 second before looping
}
Chirps, Zips, and Pings! Sound!
Example Sketch: Ringo_Guide_Chirp_01
Example Sketch: Ringo_Guide_Chirp_02