Speaker Ascend to Charge : Part Four Bug Hunt! Test your Troubleshooting.

There is a very sly bug in this program. Your code should run on the Code Speaker, but it won’t work the way the project did.

//Buggy: 'Ascend to Charge', a popular song during baseball games // In this version, the song speeds up by double each time it plays int C = 523; int E = 659; int G = 784; int A = 880; //C,E,G,A,E,G is the sequence of notes for this song int note = 150; //how long each note plays void setup(){ pinMode(10,OUTPUT); //Set the Speaker as an OUTPUT } void loop(){ tone(10,C); delay(note); tone(10,E); delay(note); tone(10,G); delay(note); tone(10,A); delay(note*2); //This note is held for twice the value of the variable tone(10,E); delay(note); tone(10,G); delay(note*4); //Hold the end note for four times the value of the variable. noTone(10); delay(3000); //wait 3 seconds before replaying the song note == note/2; //each time the loop runs, the value of 'note' is cut in half } // (c) 2018 Let's Start Coding. License: www.letsstartcoding.com/bsdlicense
 



Need a hint? Click here.