Very simple class to give slow speed PWM using timers and digital out.

Example use...

#include "SlowPWM.h"
SlowPWM MyTimer1(LED1);
SlowPWM MyTimer2(LED2);
SlowPWM MyTimer3(LED3);

main()
{
    MyTimer1.setPeriod(4);
    MyTimer1.setHighTime(2);
    MyTimer1.start();
    MyTimer2.setPeriod(2);
    MyTimer2.setHighTime(1.5);
    MyTimer2.start();
    MyTimer3.setPeriod(3.8);
    MyTimer3.setHighTime(1.5);
    MyTimer3.start();
    while(true) {
        wait(1);
    }
}

History

Added auto start stop to setHighTime; default tip

2019-06-21, by AndyA [Fri, 21 Jun 2019 09:45:08 +0000] rev 3

Added auto start stop to setHighTime;


Re-order constructor arguments.; Add special case handling for duty cycles of 0 or 1.; Stop now also cancels any scheduled turn off.

2019-06-21, by AndyA [Fri, 21 Jun 2019 09:33:26 +0000] rev 2

Re-order constructor arguments.; Add special case handling for duty cycles of 0 or 1.; Stop now also cancels any scheduled turn off.


Fixed stupid case errors

2019-06-18, by AndyA [Tue, 18 Jun 2019 16:22:56 +0000] rev 1

Fixed stupid case errors


Initial commit.;

2019-06-18, by AndyA [Tue, 18 Jun 2019 10:52:51 +0000] rev 0

Initial commit.;