z hl
/
DISCO-F429ZI_LEDs_Button
DISCO-F429ZI
Revision 0:326cb4830328, committed 2017-06-15
- Comitter:
- zhlyz2003
- Date:
- Thu Jun 15 16:47:33 2017 +0000
- Commit message:
- STM32F429Discovery
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jun 15 16:47:33 2017 +0000 @@ -0,0 +1,38 @@ +#include "mbed.h" + +DigitalOut led_green(LED1); +DigitalOut led_red(LED2); + +InterruptIn user_button(USER_BUTTON); + +float delay_on = 0.2; +float delay_off = 1.0; + +void button_pressed() +{ + delay_on = 0.1; + delay_off = 0.1; +} + +void button_released() +{ + delay_on = 0.2; + delay_off = 1.0; +} + +int main() +{ + user_button.rise(&button_pressed); + user_button.fall(&button_released); + + while(1) { + // LEDs are ON + led_green = 1; + led_red = 1; + wait(delay_on); + // LEDs are OFF + led_green = 0; + led_red = 0; + wait(delay_off); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jun 15 16:47:33 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/0f02307a0877 \ No newline at end of file