by Budd Churchward - WB7FHC - NIBBLES AND BITS LIBRARY 'My Dog Has Fleas' - A Binary Music Machine« 1 2 3 4 5 6 7 8 9 10 11 12 » |
Section 9 - Four Buttons → Fifteen Notes [Changing the Sketch]
Begin by deleting the lines highlighted in orange as you see on the right.
Then add the two lines highlighted in yellow in their place.
We are creating two sets of data. They are often called 'arrays'. You will see that they are the same values we saw in our frequency chart. Notice that each set begins with the value '0'. The reason for this has to do with how data is accessed in an array. Our sketch will point to a frequency with a number representing its position in the array. It is important to know that we start numbering these positions with zero. We are not going to have a note numbered '0' so we have put a zero in the first spot of each array as a place holder. |
|
void setup ()
remains the same with our new version but we will be replacing all
of void loop ().
Gut out the lines highlighted in orange and replace them with the two highlighted in yellow. If you compile this code now, you are going to see errors. In the next section we will write this new procedure called: buildNote(). |
|