ICRS Eurobot 2013

Dependencies:   mbed mbed-rtos Servo QEI

Revision:
12:d4b5851742a3
Parent:
11:bbddc908c78c
Child:
14:c638d4b9ee94
diff -r bbddc908c78c -r d4b5851742a3 main.cpp
--- a/main.cpp	Fri Apr 05 17:47:06 2013 +0000
+++ b/main.cpp	Fri Apr 05 21:49:23 2013 +0000
@@ -37,6 +37,7 @@
 
 */
 #include "mbed.h"
+#include "rtos.h"
 Serial pc(USBTX, USBRX);
 
 const PinName P_SERVO_LOWER_ARM = p5;
@@ -65,6 +66,7 @@
 #include "Sensors/Encoders/Encoder.h"
 #include "Sensors/Colour/Colour.h"
 #include "Sensors/CakeSensor/CakeSensor.h"
+#include "Processes/Printing/Printing.h"
 
 
 
@@ -80,6 +82,8 @@
 void ledphototransistortest();
 void colourtest();
 void cakesensortest();
+void printingtestthread(void const*);
+void printingtestthread2(void const*);
 
 int main() {
     
@@ -95,9 +99,43 @@
     //motortestline();
     //ledtest();
     //phototransistortest();
-    ledphototransistortest();
+    //ledphototransistortest();
     //colourtest(); // Red SnR too low
-    cakesensortest();
+    //cakesensortest();
+    DigitalOut l1(LED1);
+    Thread p(printingThread,        NULL,   osPriorityNormal,   2048);
+    l1=1;
+    Thread a(printingtestthread,    NULL,   osPriorityNormal,   1024);
+    Thread b(printingtestthread2,   NULL,   osPriorityNormal,   1024);
+    Thread::wait(osWaitForever);
+}
+
+#include <cstdlib>
+using namespace std;
+
+void printingtestthread(void const*){
+    const char ID = 1;
+    float buffer[3] = {ID};
+    registerID(ID,sizeof(buffer)/sizeof(buffer[0]));
+    while (true){
+        for(size_t i = 1; i != sizeof(buffer)/sizeof(buffer[0]); ++i){
+            buffer[i] =ID ;
+        }
+        updateval(ID, buffer, sizeof(buffer)/sizeof(buffer[0]));
+        Thread::wait(200);
+    }
+}
+void printingtestthread2(void const*){
+    const char ID = 2;
+    float buffer[5] = {ID};
+    registerID(ID,sizeof(buffer)/sizeof(buffer[0]));
+    while (true){
+        for(size_t i = 1; i != sizeof(buffer)/sizeof(buffer[0]); ++i){
+            buffer[i] = ID;
+        }
+        updateval(ID, buffer, sizeof(buffer)/sizeof(buffer[0]));
+        Thread::wait(500);
+    }
 }
 
 void cakesensortest(){