writing values on a led
Dependencies: Hotboards_leds mbed
Revision 0:a0ed46c36cdc, committed 2016-02-29
- Comitter:
- RomanValenciaP
- Date:
- Mon Feb 29 20:03:19 2016 +0000
- Commit message:
- first release - requires approval
Changed in this revision
diff -r 000000000000 -r a0ed46c36cdc Hotboards_leds.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hotboards_leds.lib Mon Feb 29 20:03:19 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/Hotboards/code/Hotboards_leds/#ea0715867677
diff -r 000000000000 -r a0ed46c36cdc main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Feb 29 20:03:19 2016 +0000 @@ -0,0 +1,30 @@ + +/* + * This program blinks a led but this time we will show you + * how to use the write function to manipulate the led state + * according to a variable value + * + */ + +#include "mbed.h" +#include "Hotboards_leds.h" + +//bitRead macro taken from arduino +#define bitRead( var, bit ) (((var) >> (bit)) & 0x01) + +Hotboards_leds led( PA_5 ); + +uint8_t counter; + +int main() +{ + while(1) + { + //The led will blink because we are writing the LSB + //of the variable counter which on each iteration + //is incremented by 1. + led.write( bitRead( counter , 0 ) ); + wait_ms( 200 ); + counter ++; + } +}
diff -r 000000000000 -r a0ed46c36cdc mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Feb 29 20:03:19 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/252557024ec3 \ No newline at end of file