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-25
Revision:
4:3b34689ec230
Parent:
3:f317d057edde

File content as of revision 4:3b34689ec230:

#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);
    }
}