Speaker Morse Code: Part Two Bug Hunt! Test your Troubleshooting.

This code won’t upload to your Speaker. Can you find the error before you even press ‘Upload’ ?

/*Use variables for Morse Code messages. This will make it much easier to update the speed of messages Rules of Morse Code: - Dots are 1 'unit' - Dashes are 3 'units' (3 times as long as a dot) - Spaces between symbols within the same letter are 1 'unit' of no signal - Spaces between letters are 3 'units' of no signal - Spaces between words are 7 'units' of no signal */ int dit = 200; //milliseconds that a dot will last int dash = dot*3; //milliseconds that a dash will last int symbol = dot; // space between symbols are the same duration as a dot int letter = symbol*3; //space between letters are 3 times the duration of symbol spaces int wordSpace = symbol*7; //space between words are 7 times the duration of symbol spaces int pitch = 500; //the hertz value that will be used for your tones void setup(){ pinMode(10,OUTPUT); //Set Speaker as an 'OUTPUT' } void loop(){ //S tone(10,pitch); //Play a tone of 'pitch' on the speaker delay(dot); //wait one 'dot' with tone playing noTone(10); delay(symbol); //wait before the next symbol in a letter tone(10,pitch); //Play a tone of 'pitch' on the speaker delay(dot); //wait one 'dot' with tone playing noTone(10); delay(symbol); //wait before the next symbol in a letter tone(10,pitch); //Play a tone of 'pitch' on the speaker delay(dot); //wait one 'dot' with tone playing noTone(10); delay(letter); //wait before the next symbol in a letter //O tone(10,pitch); //Play a tone of 'pitch' on the speaker delay(dash); //wait one 'dot' with tone playing noTone(10); delay(symbol); //wait before the next symbol in a letter tone(10,pitch); //Play a tone of 'pitch' on the speaker delay(dash); //wait one 'dot' with tone playing noTone(10); delay(symbol); //wait before the next symbol in a letter tone(10,pitch); //Play a tone of 'pitch' on the speaker delay(dash); //wait one 'dot' with tone playing noTone(10); delay(letter); //wait before the next symbol in a letter //S tone(10,pitch); //Play a tone of 'pitch' on the speaker delay(dot); //wait one 'dot' with tone playing noTone(10); delay(symbol); //wait before the next symbol in a letter tone(10,pitch); //Play a tone of 'pitch' on the speaker delay(dot); //wait one 'dot' with tone playing noTone(10); delay(symbol); //wait before the next symbol in a letter tone(10,pitch); //Play a tone of 'pitch' on the speaker delay(dot); //wait one 'dot' with tone playing noTone(10); delay(wordSpace); //wait before the next word } // (c) 2018 Let's Start Coding. License: www.letsstartcoding.com/bsdlicense
 



Need a hint? Click here.