![](/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:
- 39:0ab266251e86
- Parent:
- 38:47c075a354b5
- Child:
- 40:179591b10b44
diff -r 47c075a354b5 -r 0ab266251e86 LEDDriver.cpp --- a/LEDDriver.cpp Wed May 02 12:44:26 2018 +0000 +++ b/LEDDriver.cpp Wed May 02 14:25:23 2018 +0000 @@ -16,12 +16,9 @@ poll(numberOfLeds,2) ; Ticker ticker; while(true) - { + { poll(numberOfLeds,1) ;//prep multi - for(int i =0;i<numberOfLeds;i++) - { - ticker.attach(this,&LEDDriver::sendData,0.000000625f); - } + ticker.attach(this,&LEDDriver::sendData,0.0002625f); poll(numberOfLeds,2) ; } } @@ -48,11 +45,11 @@ { 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) + osEvent event = queue->get(); + int temp = *((int*)event.value.p); + if(temp==1||temp==1||temp==2||temp==3) { - messageList[i]=1; + messageList[i]=temp; } } } @@ -60,11 +57,11 @@ { 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) + osEvent event = queue->get(); + int temp = *((int*)event.value.p); + if(temp==1||temp==1||temp==2||temp==3) { - messageList[i]=1; + messageList[i]=temp; } } } @@ -73,42 +70,42 @@ void LEDDriver::sendData() { // 1 1 1 1 0 0 0 0 0 1 - static int codedMessage0[]={1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0};//{1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,0}; currently frequency measure message(standard square wave) + static int codedMessage0[]={1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1};//{1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,0,1,1,0}; currently frequency measure message(standard square wave) // 1 1 1 1 0 1 0 0 0 1 - static int codedMessage1[]={1,0,1,0,1,0,1,0,0,1,1,0,0,1,0,1,0,1,1,0}; + static int codedMessage1[]={1,0,1,0,1,0,1,0,0,1,1,0,0,1,0,1,0,1,1,0,1}; // 1 1 1 1 1 0 1 0 0 1 - static int codedMessage2[]={1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0}; + static int codedMessage2[]={1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1}; // 1 1 1 1 1 1 0 0 0 1 - static int codedMessage3[]={1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,1,0}; + static int codedMessage3[]={1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,1,0,1}; 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 for(int led =0 ; led<8;led++) { - for(int j =0;j<20;j++) + for(int j =0;j<21;j++) { if(messageList[led]==0) { leds[led].write(codedMessage0[j]); - ownWait(25);//100HZ + ownWait(250);//100HZ } else if(messageList[led]==1) { leds[led].write(codedMessage1[j]); - ownWait(25); + ownWait(70); } else if(messageList[led]==2) { leds[led].write(codedMessage2[j]); - ownWait(25); + ownWait(70); } else if(messageList[led]==3) { leds[led].write(codedMessage3[j]); - ownWait(25); + ownWait(70); } else if(messageList[led]==4) { leds[led].write(codedMessage4[j]); - ownWait(25); + ownWait(70); } } }