Reference   Language | Libraries | Comparison | Changes




This function generates a PWM signal on any digital pin with frequency and duty cycle specified as arguments. The timer is consumed once PWM is set, stopping any interrupt generation that was set up as timer.


CurieTimerOne.pwmStart(int outputPin, int dutyRange, unsigned int periodUsec)
CurieTimerOne.pwmStart(int outputPin, double dutyPercentage, unsigned int periodUsec)


outputPin: is the digital pin on which we want to generate the pwm signal.

dutyRange: is the value expressed as an integer from 0 to 1023, where a 50% duty cycle is 512 and 255 equals 24.9% of duty cycle.

dutyPercentage: is the value expressed as a floating point percentage. This function manages only one decimal position.

periodUsec: is the lenght of the PWM waveform period, expressed in microseconds. To convert this value to hertz, use this formula:



See also

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.