![](/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:
- 12:1dc7dfe499fd
- Parent:
- 10:7871aeacea08
--- a/LEDDriver.cpp Wed Apr 25 07:24:18 2018 +0000 +++ b/LEDDriver.cpp Wed Apr 25 09:27:31 2018 +0000 @@ -1,5 +1,4 @@ #include "LEDDriver.h" -Serial pc(USBTX,USBRX); LEDDriver::LEDDriver( int* sharedDirections, int sizeOfSharedDirections) { @@ -29,6 +28,10 @@ { messageList[led]=3; } + else if(directionValue==4) + { + messageList[led]=4; + } } int LEDDriver::getDirection(int id) @@ -39,16 +42,19 @@ void LEDDriver::drive(int numberOfLeds) { - encodeAll(numberOfLeds);// 1 1 1 1 0 0 0 0 0 1 + determineAll(numberOfLeds);//needs to be removed after multithreading + // 1 1 1 1 0 0 0 0 0 1 links 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) - // 1 1 1 1 0 1 0 0 0 1 + // 1 1 1 1 0 1 0 0 0 1 rechts 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 0 1 0 0 1 + // 1 1 1 1 1 0 1 0 0 1 rechtdoor 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 0 0 0 1 + // 1 1 1 1 1 1 0 0 0 1 achteruit 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 codedMessage4[]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; //default if no directions are received yet while(true) { + // determineAll(numberOfLeds); prep for multithreading for(int j=0;j<20;j++) { for(int i =0;i<numberOfLeds;i++) @@ -73,6 +79,11 @@ leds[i].write(codedMessage3[j]); ownWait(10); } + else if(messageList[i]==4) + { + leds[i].write(codedMessage4[j]); + ownWait(10); + } } } } @@ -83,7 +94,7 @@ drive(numberOfLeds); } -void LEDDriver::encodeAll(int numberOfLeds) +void LEDDriver::determineAll(int numberOfLeds) { for(int i = 0;i<numberOfLeds;i++) {