Basic example showing how to use the High Brightness LED present on the Discovery F334C8 board.
Dependencies: HiBrightLED mbed
Revision 0:adf2e8b61a3d, committed 2015-06-17
- Comitter:
- bcostm
- Date:
- Wed Jun 17 06:33:41 2015 +0000
- Commit message:
- Initial version.
Changed in this revision
diff -r 000000000000 -r adf2e8b61a3d HiBrightLED.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HiBrightLED.lib Wed Jun 17 06:33:41 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/ST/code/HiBrightLED/#c95c484b95a9
diff -r 000000000000 -r adf2e8b61a3d main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jun 17 06:33:41 2015 +0000 @@ -0,0 +1,55 @@ +#include "mbed.h" +#include "HiBrightLED.h" + +/* + Example showing how to use the High Brightness LED present + on the DISCO-F334C8 board. +*/ + +DigitalOut red_led(LED1); + +InterruptIn user_button(USER_BUTTON); + +HiBrightLED hib_led; + +uint32_t blink; + +void button_pressed() { + static uint32_t state = 1; + blink = 0; + switch (state) { + case 0: + hib_led = 0.0; // OFF + break; + case 1: + hib_led = 0.05; // ON intermediate 1 + break; + case 2: + hib_led = 0.2; // ON intermediate 2 + break; + case 3: + hib_led = 1.0; // ON MAX + break; + case 4: + hib_led = 0.0; // ON / OFF + blink = 1; + default: + break; + } + state++; + if (state > 4) state = 0; +} + +int main() +{ + user_button.fall(&button_pressed); + + while(1) + { + red_led = !red_led; + if (blink) { + hib_led = !hib_led; + } + wait(0.3); + } +}
diff -r 000000000000 -r adf2e8b61a3d mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jun 17 06:33:41 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7 \ No newline at end of file