Datasheet
BOE Shield-Bot Navigation • Chapter 4
Robotics with the BOE Shield-Bot • 129
Then, your sketch could fill in the values of each element later, perhaps with sensor
measurements, values entered from the Serial Monitor, or whatever numbers you need to
store.
The diagram below shows the musical notes on the right side of a piano keyboard. Each key
press on a piano key makes a string (or a speaker if it’s electric) vibrate at a certain
frequency.
Compare the frequencies of the leftmost eight white keys to the values in the note array.
Using Array Elements
An array element doesn’t necessarily need to be copied to another variable to use its value.
For example, your sketch could just print the value in
note[3] to the Serial Monitor like this:
Serial.print(note[3]);
Since the values in the array are musical notes, we might as well play this note on the BOE
Shield-Bot’s piezospeaker! Here's how:
tone(4, note[3], 500);