AES-2015 / Mbed 2 deprecated Nucleo_URobot

Dependencies:   mbed

Revision:
0:a4ad8cb94c43
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PositionSetter.cpp	Thu Nov 12 03:53:37 2015 +0000
@@ -0,0 +1,24 @@
+#include "PositionSetter.h"
+
+PositionSetter::PositionSetter() {
+    // when no arguments, set to default
+    // 3 axes (or motors )with 5 positions
+    NofAxes = 3;
+    NofPositions = 5;
+    // first allocate memory 
+    // for Position
+    Position =  (Degree **) malloc(sizeof(Degree *) * NofAxes);
+    for (int i = 0;  i < NofAxes; i++) { 
+        Position[i] = (Degree *) malloc(sizeof(Degree) * NofPositions);
+    }
+    // for Duration
+    Duration = (Time *) malloc(sizeof(Time) * NofPositions);
+    Write = (bool *) malloc (sizeof(bool) * NofPositions); 
+    for (int i = 0; i < NofPositions; i++) {
+        for (int j = 0; j < NofAxes; j++) {
+            Position[j][i] = (Degree) i*j;
+        } 
+        Duration[i] = (Time) i;
+        Write[i] = true;
+    }
+}
\ No newline at end of file