Provides an extended version of DigitalOut that adds a "toggle()" function, and uses the RTOS Thread API to provide a "flash()" function that toggles the pin in the background at a given interval.

Dependents:   Car_Simulator

Example of use:

#include "mbed.h"
#include "rtos.h"    /* NOTE: Requires the RTOS library or a matching API */
#include "DigitalOutEx.h"

DigitalOutEx led1(LED1);
DigitalOutEx led2(LED2);

int main() {
    
    led1.flash(200);
    led2.flash(500);
    
    Thread::wait(5000);
    
    led1.flash(50);
    
    Thread::wait(5000);
    
    led1 = 0;
    
    Thread::wait(5000);
    
    led1.flash(1000);
    
    while (1) { }    
}

History

Fixed a memory leak (I am an idiot). default tip

2013-04-26, by Byrn [Fri, 26 Apr 2013 11:31:13 +0000] rev 1

Fixed a memory leak (I am an idiot).


Initial commit.

2013-04-26, by Byrn [Fri, 26 Apr 2013 10:31:31 +0000] rev 0

Initial commit.