Run up to 32 channels of low speed PWM (up to ~10kHz@80MHz clock).
More...
#include <pwm32.h>
|
| PWM32 () |
|
void | Start (void) |
| Start a cog with the PWM runner. More...
|
|
void | Stop (void) |
| Stop the cog, if running. More...
|
|
void | Duty (int pin, int duty_cycle, int period) |
| Output a PWM wave with a calculated duty. More...
|
|
void | Servo (int pin, int pulse_width) |
| Output a servo compatible pulse with a period of 20ms. More...
|
|
void | PWM (int pin, int on_time, int off_time) |
| Output a series of square waves with a high time of on_time microseconds, and a period of (on_time + low_time) microseconds. More...
|
|
Run up to 32 channels of low speed PWM (up to ~10kHz@80MHz clock).
No external hardware beyond the PWM devices is needed. Works with H bridges, LEDs, servos, and anything else that takes a repeating PWM signal.
Copyright (c) 2013 Kenneth Bedolla (libpr.nosp@m.opel.nosp@m.ler@k.nosp@m.enne.nosp@m.thbed.nosp@m.olla.nosp@m..com)
void PWM32::Duty |
( |
int |
pin, |
|
|
int |
duty_cycle, |
|
|
int |
period |
|
) |
| |
|
inline |
Output a PWM wave with a calculated duty.
- Parameters
-
pin | The I/O pin to use (0..31) |
duty_cycle | The duty cycle (0..100) to use. 0 is off, 100 is full on. |
period | The period (in uS) of the cycle. |
void PWM32::PWM |
( |
int |
pin, |
|
|
int |
on_time, |
|
|
int |
off_time |
|
) |
| |
|
inline |
Output a series of square waves with a high time of on_time microseconds, and a period of (on_time + low_time) microseconds.
- Parameters
-
pin | The I/O pin to use (0..31) |
on_time | The duration of the high time, in uS. |
off_time | The duration of the low time, in uS. |
void PWM32::Servo |
( |
int |
pin, |
|
|
int |
pulse_width |
|
) |
| |
|
inline |
Output a servo compatible pulse with a period of 20ms.
- Parameters
-
pin | The I/O pin to use (0..31) |
pulse_width | The width of the servo pulse in uS. Can be any value, but most servos require a range (1000..2000) |
void PWM32::Start |
( |
void |
) | |
|
|
inline |
Start a cog with the PWM runner.
void PWM32::Stop |
( |
void |
) | |
|
|
inline |
Stop the cog, if running.
const int PWM32::Resolution = 8200 |
|
static |
The documentation for this class was generated from the following file: