![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First version
Dependencies: mbed EthernetInterface mbed-rto
Diff: main.cpp
- Revision:
- 20:fe6a58e84929
- Parent:
- 19:4997b02d6a88
- Child:
- 24:bf62c46acb3e
- Child:
- 26:4c673da1a3ae
diff -r 4997b02d6a88 -r fe6a58e84929 main.cpp --- a/main.cpp Wed Apr 18 13:58:46 2018 +0000 +++ b/main.cpp Wed Apr 18 14:34:31 2018 +0000 @@ -1,53 +1,23 @@ #include "mbed.h" +#include "rtos.h" #include "Interpreter.h" #include "TCPlistener.h" int main (void){ - int LED[12]; - for(int i=0;i<12;i++){ + int LED[8]; + for(int i=0;i<8;i++){ LED[i]=-1; } Interpreter interpreter(LED); - TCPlistener listener; - char command[512]; - listener.receiveSegment(command,sizeof(command)); - interpreter.executeCommand(command); - - for(int i=0;i<8;i++){ - printf("LED %i, oriëntatie: %i\r\n",i,LED[i]); - } - - /* - char command[512]; - listener.receiveSegment(command,sizeof(command)); - */ - #if 0 - Mutex* lock=new Mutex(); - int LED[12]; - for(int i=0;i<12;i++){ - LED[i]=-1; - } - Receiver receiver(LED,lock); - reciever.init(); - #endif - - /* - Thread receiverThread; - - receiverThread.start(receiver.run); - */ - - - //std::thread receiverThread(&Receiver::run, &receiver); - - - /* - - Thread ledThread; - - receiverThread.start(Receiver); - */ + while(true){ + listener.receiveSegment(command,sizeof(command)); + interpreter.executeCommand(command); + + for(int i=0;i<8;i++){ + printf("LED %i, richting: %i\r\n",i,LED[i]); + } + } }