![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First version
Dependencies: mbed EthernetInterface mbed-rto
Diff: LEDDriver.cpp
- Revision:
- 71:5e8ba1357442
- Parent:
- 68:8b42082accc2
- Child:
- 72:d870f5503783
--- a/LEDDriver.cpp Mon May 14 20:02:42 2018 +0000 +++ b/LEDDriver.cpp Tue May 15 16:53:09 2018 +0000 @@ -1,5 +1,7 @@ #include "LEDDriver.h" -LEDDriver::LEDDriver( Queue<int,8>* queue) +DigitalOut led2(LED2); + +LEDDriver::LEDDriver( Queue<int,1>* queue) { this->queue=queue; initArrays(); @@ -11,6 +13,7 @@ if(currentLocation==0){ poll(numberOfLeds); } + led2!=led2; setLEDS(currentLocation); currentLocation++; @@ -25,15 +28,12 @@ void LEDDriver::poll(int numberOfLeds) { - for(int i =0;i<(numberOfLeds);i++) - { - osEvent event = queue->get(); - int temp = *((int*)event.value.p); - if(temp==0||temp==1||temp==2||temp==3||temp==4) - { - messageList[i]=temp; - } - } + osEvent event = queue->get(); + if (event.status == osEventMessage){ + int* LEDarray = ((int*)event.value.p); + memcpy(messageList,LEDarray,8*sizeof(int)); + free(LEDarray); + } } void LEDDriver::initArrays()