AGH UST MBED part 2
Dependencies: LCD_DISCO_F429ZI mbed BSP_DISCO_F429ZI
main.cpp@0:e65dff476cf0, 2020-05-09 (annotated)
- Committer:
- matis755
- Date:
- Sat May 09 08:53:44 2020 +0000
- Revision:
- 0:e65dff476cf0
- Child:
- 1:42a82d41947f
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
matis755 | 0:e65dff476cf0 | 1 | #include "mbed.h" |
matis755 | 0:e65dff476cf0 | 2 | |
matis755 | 0:e65dff476cf0 | 3 | DigitalOut led_green(LED1); |
matis755 | 0:e65dff476cf0 | 4 | DigitalOut led_red(LED2); |
matis755 | 0:e65dff476cf0 | 5 | |
matis755 | 0:e65dff476cf0 | 6 | DigitalIn user_button(USER_BUTTON); |
matis755 | 0:e65dff476cf0 | 7 | |
matis755 | 0:e65dff476cf0 | 8 | float delay = 0.5; |
matis755 | 0:e65dff476cf0 | 9 | |
matis755 | 0:e65dff476cf0 | 10 | int main() |
matis755 | 0:e65dff476cf0 | 11 | { |
matis755 | 0:e65dff476cf0 | 12 | while(1) { |
matis755 | 0:e65dff476cf0 | 13 | |
matis755 | 0:e65dff476cf0 | 14 | if(user_button){ |
matis755 | 0:e65dff476cf0 | 15 | led_red = 0; |
matis755 | 0:e65dff476cf0 | 16 | led_green = !led_green; |
matis755 | 0:e65dff476cf0 | 17 | } |
matis755 | 0:e65dff476cf0 | 18 | else{ |
matis755 | 0:e65dff476cf0 | 19 | led_green = 0; |
matis755 | 0:e65dff476cf0 | 20 | led_red = !led_red; |
matis755 | 0:e65dff476cf0 | 21 | } |
matis755 | 0:e65dff476cf0 | 22 | wait(delay); |
matis755 | 0:e65dff476cf0 | 23 | } |
matis755 | 0:e65dff476cf0 | 24 | } |