Timers_Class

setPWMDuty()

Description

Pulse Width Modulation is a technique for getting analog results with digital means. Digital control is used to create a square wave, a signal switched between ON and OFF. The duration of "on time", measured as a pourcentage, is called duty cycle. To get varying analog values, you change or modulate that pulse width but using the above function, keeping the period the same.

You can learn more details about PWM mechanism from this arduino example.

Syntax

timer.setPWMDuty(val)

Parameters

timer: a variable of type Timers_Class .

val: the choosen value of duty cycle, type uint8_t.

Examples

Demo Video Shows with easy examples, the impact of modifying PWM duty cycle in led brightness, servo speed and speaker voice.

See also

Corrections, suggestions, and new documentation can be added directly to the wiki page. Scroll to the bottom, choose "Edit Page" and use "Papilio" as the password.

  

Share |