Given LED PinName and blink interval, spawns a thread that blinks that LED at the specified interval

Dependents:   Blinky_Tests Blinky_Tests_GreenTea1

Embed: (wiki syntax)

« Back to documentation index

Blinky Class Reference

Interface to start a thread that blinks an LED. More...

#include <Blinky.h>

Public Member Functions

 Blinky (PinName led, int interval)
 Create a Blinky.
void start ()
 Start a thread executing blink_led.
void stop ()
 Terminate the thread blinking the LED.

Protected Member Functions

void blink_led ()
 Function to blink the LED.

Protected Attributes

Thread _blinker
 Thread to execute blink_led.
DigitalOut _led
 LED to blink.
int _interval
 Interval of time between blinks.
bool stop_blink
 Bool to stop blinking LED.

Detailed Description

Interface to start a thread that blinks an LED.

Definition at line 28 of file Blinky.h.


Constructor & Destructor Documentation

Blinky ( PinName  led,
int  interval 
)

Create a Blinky.

Parameters:
ledA PinName, the pin name of the LED to blink
intervalA int, the interval of time between LED blinks

Definition at line 3 of file Blinky.cpp.


Member Function Documentation

void blink_led (  ) [protected]

Function to blink the LED.

Definition at line 15 of file Blinky.cpp.

void start (  )

Start a thread executing blink_led.

Definition at line 8 of file Blinky.cpp.

void stop (  )

Terminate the thread blinking the LED.

Definition at line 11 of file Blinky.cpp.


Field Documentation

Thread _blinker [protected]

Thread to execute blink_led.

Definition at line 45 of file Blinky.h.

int _interval [protected]

Interval of time between blinks.

Definition at line 49 of file Blinky.h.

DigitalOut _led [protected]

LED to blink.

Definition at line 47 of file Blinky.h.

bool stop_blink [protected]

Bool to stop blinking LED.

Definition at line 51 of file Blinky.h.