The simplest program , blink a led on pin PA_5
Dependencies: Hotboards_leds mbed
Fork of led by
main.cpp@1:87da85491aaa, 2016-03-15 (annotated)
- Committer:
- Hotboards
- Date:
- Tue Mar 15 18:04:52 2016 +0000
- Revision:
- 1:87da85491aaa
- Parent:
- 0:b5cfc5f155cb
Added header to Hotboards_leds.cpp
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RomanValenciaP | 0:b5cfc5f155cb | 1 | |
Hotboards | 1:87da85491aaa | 2 | /* |
Hotboards | 1:87da85491aaa | 3 | * file Hotboards_leds.cpp |
Hotboards | 1:87da85491aaa | 4 | * autor Diego |
Hotboards | 1:87da85491aaa | 5 | * modified by Roman |
Hotboards | 1:87da85491aaa | 6 | * contact hotboards.org |
Hotboards | 1:87da85491aaa | 7 | * |
Hotboards | 1:87da85491aaa | 8 | * Description |
RomanValenciaP | 0:b5cfc5f155cb | 9 | * The simplest program I, blink a led on pin PA_5 |
Hotboards | 1:87da85491aaa | 10 | * This sketch show how to use the Hotboards_leds library |
Hotboards | 1:87da85491aaa | 11 | * for toggling a led |
RomanValenciaP | 0:b5cfc5f155cb | 12 | */ |
RomanValenciaP | 0:b5cfc5f155cb | 13 | |
RomanValenciaP | 0:b5cfc5f155cb | 14 | #include "mbed.h" |
RomanValenciaP | 0:b5cfc5f155cb | 15 | #include "Hotboards_leds.h" |
RomanValenciaP | 0:b5cfc5f155cb | 16 | |
RomanValenciaP | 0:b5cfc5f155cb | 17 | //Creates a simple led object |
RomanValenciaP | 0:b5cfc5f155cb | 18 | Hotboards_leds led( PA_5 ); |
RomanValenciaP | 0:b5cfc5f155cb | 19 | |
RomanValenciaP | 0:b5cfc5f155cb | 20 | int main() |
RomanValenciaP | 0:b5cfc5f155cb | 21 | { |
RomanValenciaP | 0:b5cfc5f155cb | 22 | while(1) |
RomanValenciaP | 0:b5cfc5f155cb | 23 | { |
RomanValenciaP | 0:b5cfc5f155cb | 24 | //Turns ON led |
RomanValenciaP | 0:b5cfc5f155cb | 25 | led.turnOn( ); |
RomanValenciaP | 0:b5cfc5f155cb | 26 | wait_ms( 100 ); |
RomanValenciaP | 0:b5cfc5f155cb | 27 | //Turns OFF led |
RomanValenciaP | 0:b5cfc5f155cb | 28 | led.turnOff( ); |
RomanValenciaP | 0:b5cfc5f155cb | 29 | wait_ms( 100 ); |
RomanValenciaP | 0:b5cfc5f155cb | 30 | } |
RomanValenciaP | 0:b5cfc5f155cb | 31 | } |