Simple library for LED blinking.

Dependents:   roam_v2 finalV1 finalV1 finalv2 ... more

Embed: (wiki syntax)

« Back to documentation index

Blinker Class Reference

Blinker Class Reference

Simple class for learning development of libraries. More...

#include <Blinker.h>

Public Member Functions

 Blinker (PinName pin)
 Constructor receives a pin name that LED is connected to.
void blink (int n, float t=0.5)
 Function recevies number of blinks (flashes) and a time of duration of each blink.
bool isFinished ()
 Checks if the blinking is finished.

Detailed Description

Simple class for learning development of libraries.

The main task is to blink (flash) a LED connected to a specified pin N times. Each blink should last 0.5 seconds by default, or some other time that user can set.

Author: TVZ Mechatronics Team

Example of use:

 #include "mbed.h"
 #include "Blinker.h"

 int main() {
    Blinker myBlinker(LED3);
    myBlinker.blink(10);
    while(!myBlinker.isFinished()) {
        // do something else...
    }
    myBlinker.blink(5, 1);
    while(!myBlinker.isFinished()) {
        // do something else...
    }
 }

Definition at line 31 of file Blinker.h.


Constructor & Destructor Documentation

Blinker ( PinName  pin )

Constructor receives a pin name that LED is connected to.

Definition at line 4 of file Blinker.cpp.


Member Function Documentation

void blink ( int  n,
float  t = 0.5 
)

Function recevies number of blinks (flashes) and a time of duration of each blink.

Definition at line 11 of file Blinker.cpp.

bool isFinished (  )

Checks if the blinking is finished.

Returns:
true if the complete process is finished, false otherwise.

Definition at line 50 of file Blinker.cpp.