I am using arduino DUE to make a soda can piano. For which I am using capacitive touch sensor. Since tone() function isn't compatible with arduino DUE I am not being able to generate music. Is there any way to generate music without using the tone() function?
TIA!
Generate a square wave of the specified frequency at a 50% duty cycle on the pin of your choice. A duration can be implemented in your code. The pin can be connected to a piezo buzzer or other speaker to play tones. Only one tone can be generated at a time.
Sure, I wrote code for a 13-note "piano" a while back using micros() and blink without delay style programming.
The notes were mixed together externally before going to the sound making device, in my case a powered PC speaker.
Code & schematic here.
https://forum.arduino.cc/index.php?topic=179761.0
Video of it here playing up to 8 notes, as that was all the buttons I had.
TC_lib from antodom on github can be used to deal with timer counters.
@CrossRoads I tried your code out but I am unable to understand it as it is very different from my code. I am using a capacitive touch sensor with resistors and soda cans as keys.
I also tried running your code and it gives me an error that PIND was not declared.
Do you know how to solve the issue?
Thankyou! Much appreciated.
Also thankyou others for the suggestions!
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.