Simple Blinky library.

Dependents:   Blinky_Tests

Fork of Blinky by Sarah Marsh

Blinky.cpp

Committer:
sarahmarshy
Date:
2016-09-19
Revision:
1:5b51a271d47e
Parent:
0:8fe86312b714
Child:
2:256c8d48f5e7

File content as of revision 1:5b51a271d47e:

#include "Blinky.h"

Blinky::Blinky(PinName led, int interval):
        _led(led), _interval(interval){
    stop_blink=false;
    _led=1;
}
void Blinky::start(){
    _blinker.start(this, &Blinky::blink_led);
} 
void Blinky::stop(){
    stop_blink = true;
    _blinker.join();
}  
void Blinky::blink_led(){
    while (!stop_blink){
        _led = !_led;
        Thread::wait(_interval);
    }
}