First version
Dependencies: mbed EthernetInterface mbed-rto
Diff: Interpreter.cpp
- Revision:
- 24:bf62c46acb3e
- Parent:
- 20:fe6a58e84929
- Child:
- 30:915f6cb7ffa5
diff -r d87a025e4fb6 -r bf62c46acb3e Interpreter.cpp --- a/Interpreter.cpp Wed Apr 25 09:14:53 2018 +0000 +++ b/Interpreter.cpp Wed Apr 25 13:25:13 2018 +0000 @@ -1,10 +1,16 @@ #include "Interpreter.h" -Interpreter::Interpreter(int* LEDinput){ - LED=LEDinput; + + +Interpreter::Interpreter(Queue<int,8> *queue){ + Interpreter::queue=queue; } void Interpreter::executeCommand(char* command){ + for(int i=0;i<8;i++){ + LED[i]=-1; + } //Set all default on 0 + char *ID=strtok(command,"-"); char *direction=strtok(NULL," "); while((ID!=NULL)&&(direction!=NULL)){ @@ -18,6 +24,14 @@ ID=strtok(NULL,"-"); direction=strtok(NULL," "); } + + for(int i=0;i<8;i++){ + queue->put(&LED[i]); + } + + for(int i=0;i<8;i++){ + printf("LED %i, richting: %i\r\n",i,LED[i]); + } } int Interpreter::directionToNumber(char* direction){