umar saeed
/
digitalInInterrupt_sample
lab 2 complete
Diff: main.cpp
- Revision:
- 5:86742cfaf4e4
- Parent:
- 4:728667196916
- Child:
- 6:5df490a57e4a
--- a/main.cpp Tue Jan 15 10:09:53 2019 +0000 +++ b/main.cpp Thu Jan 30 08:16:04 2020 +0000 @@ -6,7 +6,7 @@ // is pressed // The callback uses a shared variable to signal another thread -InterruptIn button(PTD0); +InterruptIn button(PTD0); // Pin must be on ports A or D DigitalOut led(LED_GREEN); volatile int pressEvent = 0 ; @@ -15,7 +15,7 @@ // Signal that the button has been pressed // Note: bounce may occur void buttonCallback(){ - pressEvent = 1 ; + pressEvent = 1 ; } /* ---- Main function (default thread) ---- @@ -31,6 +31,6 @@ led = !led ; pressEvent = 0 ; // Clear the event variable } - wait(0.1) ; + ThisThread::sleep_for(100) ; // delay for 100ms } } \ No newline at end of file