turning a led ON and OFF
Dependencies: Hotboards_leds mbed
main.cpp@0:b5cfc5f155cb, 2016-02-29 (annotated)
- Committer:
- RomanValenciaP
- Date:
- Mon Feb 29 19:58:35 2016 +0000
- Revision:
- 0:b5cfc5f155cb
- Child:
- 1:624cca427a70
first release - requires approval
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RomanValenciaP | 0:b5cfc5f155cb | 1 | |
RomanValenciaP | 0:b5cfc5f155cb | 2 | /* |
RomanValenciaP | 0:b5cfc5f155cb | 3 | * The simplest program I, blink a led on pin PA_5 |
RomanValenciaP | 0:b5cfc5f155cb | 4 | * |
RomanValenciaP | 0:b5cfc5f155cb | 5 | */ |
RomanValenciaP | 0:b5cfc5f155cb | 6 | |
RomanValenciaP | 0:b5cfc5f155cb | 7 | #include "mbed.h" |
RomanValenciaP | 0:b5cfc5f155cb | 8 | #include "Hotboards_leds.h" |
RomanValenciaP | 0:b5cfc5f155cb | 9 | |
RomanValenciaP | 0:b5cfc5f155cb | 10 | //Creates a simple led object |
RomanValenciaP | 0:b5cfc5f155cb | 11 | Hotboards_leds led( PA_5 ); |
RomanValenciaP | 0:b5cfc5f155cb | 12 | |
RomanValenciaP | 0:b5cfc5f155cb | 13 | int main() |
RomanValenciaP | 0:b5cfc5f155cb | 14 | { |
RomanValenciaP | 0:b5cfc5f155cb | 15 | while(1) |
RomanValenciaP | 0:b5cfc5f155cb | 16 | { |
RomanValenciaP | 0:b5cfc5f155cb | 17 | //Turns ON led |
RomanValenciaP | 0:b5cfc5f155cb | 18 | led.turnOn( ); |
RomanValenciaP | 0:b5cfc5f155cb | 19 | wait_ms( 100 ); |
RomanValenciaP | 0:b5cfc5f155cb | 20 | //Turns OFF led |
RomanValenciaP | 0:b5cfc5f155cb | 21 | led.turnOff( ); |
RomanValenciaP | 0:b5cfc5f155cb | 22 | wait_ms( 100 ); |
RomanValenciaP | 0:b5cfc5f155cb | 23 | } |
RomanValenciaP | 0:b5cfc5f155cb | 24 | } |