![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
demo versie 16/05
Dependencies: EthernetInterface mbed-rto mbed
Fork of ProjectVLC by
Diff: LEDDriver.cpp
- Revision:
- 26:29948b116e82
- Parent:
- 25:4c673da1a3ae
- Child:
- 32:537005b4a065
--- a/LEDDriver.cpp Wed Apr 25 13:17:55 2018 +0000 +++ b/LEDDriver.cpp Wed Apr 25 14:13:22 2018 +0000 @@ -23,38 +23,39 @@ static int codedMessage4[]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};//default message for multithreading while(true) { - poll(numberOfLeds) ;//prep multi - for(int j=0;j<20;j++) - { - for(int i =0;i<numberOfLeds;i++) - { + poll(numberOfLeds,1) ;//prep multi + for(int j=0;j<20;j++) + { + for(int i =0;i<numberOfLeds;i++) + { if(messageList[i]==0) { leds[i].write(codedMessage0[j]); - ownWait(1);//7.511kHZ - } + // ownWait(1);//7.511kHZ + } else if(messageList[i]==1) { leds[i].write(codedMessage1[j]); - ownWait(1); + // ownWait(1); } else if(messageList[i]==2) { leds[i].write(codedMessage2[j]); - ownWait(1); + // ownWait(1); } else if(messageList[i]==3) { leds[i].write(codedMessage3[j]); - ownWait(1); + // ownWait(1); } else if(messageList[i]==4) { leds[i].write(codedMessage4[j]); - ownWait(1); + // ownWait(1); } - } - } + } + } + } } } @@ -74,15 +75,30 @@ } } -void LEDDriver::poll(int numberOfLeds) +void LEDDriver::poll(int numberOfLeds,int first) { - for(int i =0;i<numberOfLeds;i++) - { - osEvent event = queue->get(); - int temp = *((int*)event.value.p); - if(temp==1||temp==1||temp==2||temp==3) - { - messageList[i]=temp; - } - } + if(first==1) + { + for(int i =0;i<(numberOfLeds/2);i++) + { + osEvent event = queue->get(); + int temp = *((int*)event.value.p); + if(temp==1||temp==1||temp==2||temp==3) + { + messageList[i]=temp; + } + } + } + else if(first==2) + { + for(int i =(numberOfLeds/2);i<(numberOfLeds);i++) + { + osEvent event = queue->get(); + int temp = *((int*)event.value.p); + if(temp==1||temp==1||temp==2||temp==3) + { + messageList[i]=temp; + } + } + } } \ No newline at end of file