Hello. I would like to generate two tones simultaneously with the Arduino Uno R4 Minima. I tried using the Tone library (by Brett Hagman) but it is not compatible with the microcontroller used by the Uno R4. Is there a library that has been written for the Renesas RA4M1 microcontroller, or do I need to go back the the R3 version?
If you know the frequency you want then use the code in FspTimer.h to setup pins to output that frequency.
@Delta_G - Will the FspTimer.h library allow me to output two tones at the same time to the same pin?
Thanks,
Mike
No. I don't know of a way to get two on one pin. Not with a timer by itself. Maybe if you do all the math yourself in code and constantly update the timer top and compare to match what the wave needs to be. But that doesn't sound like something I would want to try to figure out.
This library lets you output multiple tones as a mix on one pin PWM analog output:
a7
Wavetable. That's the word I was looking for where you've got the addition calculated beforehand. I didn't know someone had it for the R4 yet.
I will have to see if it works with the R4 / Renesas RA4M1 microcontroller... Thanks!
if not -
One tone from one pin and the other tone from another, diode-OR'd (mixed) together ?
If it's for a POTS-like application - things may not 'work' since true DTMF is sine wave.
Hmm, yeah don't get your hopes up.
But. Using a wave table and a bit of maths is easy enough so the specific case of DTMF synthesis is something you shouldn't be afraid of just programming by hand.
The 4x processor speed of the R4 makes it all the more easy.
I can't find the best old article, but here's what ppl were doing with very reduced resources:
http://retro.hansotten.nl/uploads/mag6502/198004byteadvancedmusic.pdf
The article gets around to describing a four voice wave table synthesizer. I expect directly implementing the algorithm in C on the UNO R4 would succeed.
HTH
a7
Thanks for all the help. I ended up going back the the Uno R3 for this project and will be using the Mozzi library to generate the tones.
Mike
@mikeb99 Note that Mozzi is compatible with the R4
It turns out I guess it is compatible with the R4. I ran across a Mozzi spec that said it outputs the sound to Pin A0. I certainly wasn't looking for it there! I thought the analog pins were only for analog in, and not out. A built in DAC is nice!