
Interrupt experiment
Diff: main.cpp
- Revision:
- 2:0713f69f55eb
- Parent:
- 1:1407e3388ad8
--- a/main.cpp Sat Apr 13 14:12:42 2019 +0000 +++ b/main.cpp Thu May 02 12:26:45 2019 +0000 @@ -1,8 +1,9 @@ #include "mbed.h" #include "C12832.h" + C12832 lcd(p5, p7, p6, p8, p11); -InterruptIn button(p15); +InterruptIn button(p15); DigitalOut led(LED1); DigitalOut flash(LED4); @@ -10,22 +11,20 @@ void flip() { led = !led; - a = 1; - } + a = 1; + } int main () { - //button.mode(PullUp); + button.mode(PullUp); button.rise(&flip); while (1) { flash = !flash; wait(0.25); + if (a == 1) { - lcd.cls(); - lcd.locate(0,3); - lcd.printf("Varable is ON\n"); - wait(2); + lcd.printf("Variable is ON\n"); a = 0; - lcd.cls(); + } + } } -} \ No newline at end of file