gdfgdh
Dependencies: ELEC350-Practicals-FZ429
Fork of Task633-mbedos-FZ429 by
Diff: main.cpp
- Revision:
- 14:03836b560d3d
- Parent:
- 13:f05daa68720c
--- a/main.cpp Tue Nov 21 11:36:41 2017 +0000 +++ b/main.cpp Tue Nov 21 11:53:44 2017 +0000 @@ -88,6 +88,8 @@ //Normal priority thread (consumer) void thread1() { + static int counter = 0; + while (true) { //Block on the queue osEvent evt = mail_box.get(); @@ -104,10 +106,22 @@ printf("ADC Value: %.2f\t", msg.adcValue); printf("SW1: %u\t", msg.sw1State); printf("SW2: %u\n\r", msg.sw2State); + + //Toggle green + if ( (msg.sw1State == 1) && (msg.sw2State == 1)) { + counter++; + if (counter == 10) { + greenLED = !greenLED; + counter = 0; + } + } else { + counter = 0; + } + } else { printf("ERROR: %x\n\r", evt.status); } - + } //end while }