Kevin Sullivan
/
labQ2_3
Q2_3 indicating vevel of led
Revision 3:3946e355bcab, committed 2020-08-05
- Comitter:
- kevinsullivan
- Date:
- Wed Aug 05 19:00:05 2020 +0000
- Parent:
- 2:2ff289a7fba1
- Commit message:
- interrupt
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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