![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Solution
Dependencies: ELEC350-Practicals-FZ429
Fork of Task650-mbedos-FZ429ZI-eventloop by
Diff: main.cpp
- Revision:
- 11:67cb33bc247e
- Parent:
- 10:3ab2495f24d9
- Child:
- 12:01c7edd1dd19
--- a/main.cpp Mon Nov 20 10:51:32 2017 +0000 +++ b/main.cpp Tue Nov 21 13:23:58 2017 +0000 @@ -6,11 +6,10 @@ void addSample(float t); void heartBeat(); -DigitalOut led(LED1); InterruptIn btn(USER_BUTTON); //Creates a queue with the default size -EventQueue mainQueue(20); +EventQueue mainQueue; Timer tmr1; Thread t1; @@ -22,8 +21,10 @@ //Power on self test post(); + puts("Press the BLUE button as close to once a second as you can"); + //Set up ISR - btn.fall(buttonPressedISR); + btn.rise(buttonPressedISR); //Start timer tmr1.start(); @@ -57,7 +58,7 @@ //Display deltas for (unsigned int n=9; n>0; n--) { - float delta = (arrayOfTimes[n] - arrayOfTimes[n-1]); + float delta = (arrayOfTimes[n-1] - arrayOfTimes[n]); printf("%5.1f ", delta); } printf("\n"); @@ -65,5 +66,5 @@ //Flashing LED void heartBeat() { - led = !led; + redLED = !redLED; }