Library thread Blink Led or other processes use RTOS

Dependents:   LedsThreading

Fork of BlinkLed by Satoshi Togawa

Example

https://developer.mbed.org/users/AVELARDEV/code/LedsThreading/

BlinkLed.cpp

Committer:
AVELARDEV
Date:
2016-05-24
Revision:
3:f317d057edde
Parent:
2:1d0c09c1a8b4

File content as of revision 3:f317d057edde:

#include "BlinkLed.h"

BlinkLed::BlinkLed(PinName pin, int n) :
    led(pin),
    n(n)
{
}

BlinkLed::~BlinkLed()
{
}

void BlinkLed::startBlink()
{
    thread = new Thread(blink, this);
}

void BlinkLed::blink(void const *argument)
{
    BlinkLed* self = (BlinkLed*)argument;

    while(1)
    {
        self->led = !self->led;
        Thread::wait(self->n);
    }
}