EEVblog Electronics Community Forum
Electronics => Projects, Designs, and Technical Stuff => Topic started by: richcj10 on June 19, 2012, 02:48:42 am
-
I was thinking of using the Tone() fcn of Arduino but can't find out how to alter the duty cycle...
Any suggestions?
Thanks,
rick
-
You need the arduino duo which can call http://arduino.cc/en/Reference/AnalogWriteResolution (http://arduino.cc/en/Reference/AnalogWriteResolution)
tone() by definition has a 50% duty cycle.
See this article http://arduino.cc/en/Tutorial/DueSimpleWaveformGenerator (http://arduino.cc/en/Tutorial/DueSimpleWaveformGenerator)
-
You need the arduino duo which can call http://arduino.cc/en/Reference/AnalogWriteResolution (http://arduino.cc/en/Reference/AnalogWriteResolution)
tone() by definition has a 50% duty cycle.
See this article http://arduino.cc/en/Tutorial/DueSimpleWaveformGenerator (http://arduino.cc/en/Tutorial/DueSimpleWaveformGenerator)
Am I reading that right, the maximum frequency is 170 Hz? That's not very useful as a function generator. There are tutorials for the Uno that will go to at least 20 kHz, I think I've come across one that will go to 100 kHz.
-
See the date of the first post. :palm:
-
Two options:
- use analogwrite.
- use hardware pwm.