Try changing the value 4 in the line below to lower and higher values.
int pitch = 200 + reading / 4;
This will expand or restrict the range of
frequencies.
Returning to the first sketch, try and modify it to play a tune. Hint, you can just change the values in the 'tones' array. Note that if you change the number of notes from 10 notes, then you will need to change 'numTones' accordingly.
Returning to the first sketch, try and modify it to play a tune. Hint, you can just change the values in the 'tones' array. Note that if you change the number of notes from 10 notes, then you will need to change 'numTones' accordingly.
About the Author
Simon Monk is author of a number of books relating to Open Source Hardware. The following books written by Simon are available from Adafruit: Programming Arduino, 30 Arduino Projects for the Evil Genius and Programming the Raspberry Pi.
Simon Monk is author of a number of books relating to Open Source Hardware. The following books written by Simon are available from Adafruit: Programming Arduino, 30 Arduino Projects for the Evil Genius and Programming the Raspberry Pi.
Text editor powered by tinymce.