Author Topic: How to make a function generator with variable duty cycle..  (Read 996 times)

0 Members and 1 Guest are viewing this topic.

Offline richcj10

  • Regular Contributor
  • *
  • Posts: 179
  • Country: us
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

Offline mwhooker

  • Newbie
  • Posts: 1
Re: How to make a function generator with variable duty cycle..
« Reply #1 on: December 02, 2013, 11:42:51 PM »
You need the arduino duo which can call http://arduino.cc/en/Reference/AnalogWriteResolution

tone() by definition has a 50% duty cycle.

See this article http://arduino.cc/en/Tutorial/DueSimpleWaveformGenerator

Offline Six_Shooter

  • Regular Contributor
  • *
  • Posts: 117
  • Country: ca
Re: How to make a function generator with variable duty cycle..
« Reply #2 on: December 03, 2013, 01:55:38 AM »
You need the arduino duo which can call http://arduino.cc/en/Reference/AnalogWriteResolution

tone() by definition has a 50% duty cycle.

See this article 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.

Offline BravoV

  • Super Contributor
  • ***
  • Posts: 3065
  • Country: 00
  • An EEE (Eternal Electronics Enthusiast)
Re: How to make a function generator with variable duty cycle..
« Reply #3 on: December 03, 2013, 02:00:03 AM »
See the date of the first post.  :palm:

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 3449
Re: How to make a function generator with variable duty cycle..
« Reply #4 on: December 03, 2013, 09:37:59 AM »
Two options:
- use analogwrite.
- use hardware pwm.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf