![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Q2_3 indicating vevel of led
Diff: main.cpp
- Revision:
- 3:3946e355bcab
- Parent:
- 2:2ff289a7fba1
--- a/main.cpp Mon Jul 27 17:04:29 2020 +0000 +++ b/main.cpp Wed Aug 05 19:00:05 2020 +0000 @@ -9,8 +9,8 @@ int i; void flip() { - led = !led; // toggles the led when the joystick button is pressed. - i=led; + led = !led; // toggles the LED1 when the joystick button is pressed. + i=1; } int main() { @@ -21,19 +21,11 @@ flash = !flash; // turns LED4 on if off, off if on wait(0.5); // the instruction to wait for half-second - - if(i==0) { - lcd.locate(0,0); - lcd.printf("stand-by \n\r"); - wait (0.1); - lcd.printf("LED1 = 0 \n\r"); - wait (0.2); - } if(i==1) { lcd.locate(0,0); - lcd.printf("button press detected\n"); - lcd.printf("LED = 1 \n\r"); - wait (0.2); - } + lcd.printf("button press detected\n\r"); + lcd.printf("LED1\n\r"); + i=0; + } } } \ No newline at end of file