This class is used to generate a PWM signal on ANY outout pin using software rather than hardware timers. The granularity of the timer is multiples of 1ms. Hence it is not suitable for servos but is ideal for driving DC motors, dimming LEDs etc.
This class extends Out.hpp so that it can use any output pin.
To create an output which is high for every 1ms per 20ms on port D5 use:
PWMOUT pin('D',5, 20, 1);
The duty cycle can be varied, ie by modifying the last parameter given in the constructor, by:-
void setOnTime(uint16_t onTime); // set the number of ms when the signal is high
uint16_t getOnTime(); // get the number of ms when the signal is high - either from constructor or last call to setOnTime
uint16_t getCycleTime(); // get the ms per cycle as given in the constructor
So if you want an LED on port D5 to flash for 1 second every 3 seconds then just declare:
PWMOUT led('D',5,3000,1000); // Thats all you need to do!!!!!