Robert Bui / Mbed 2 deprecated CubicHand

Dependencies:   MMA8451Q Multi_WS2811 NVIC_set_all_priorities TSI cc3000_hostdriver_mbedsocket mbed

Fork of CubicHand by Model-Based Team

Revision:
26:0933d7f2fe78
Parent:
24:554ea084eddf
Child:
27:0e341d81ea00
--- a/ledCube.cpp	Thu Dec 11 04:24:28 2014 +0000
+++ b/ledCube.cpp	Thu Dec 11 05:40:39 2014 +0000
@@ -18,11 +18,11 @@
 #define PANEL1             0
 #define PANEL2             1
 #define PANEL3             2
-#define nLEDs              200//MAX_LEDS_PER_STRIP;
-#define nROWs              10
-#define nCOLs              10  
-#define DATA_OUT_PIN1      2 // PTD2
-#define DATA_OUT_PIN2      3 // PTD3 
+#define nLEDs              200 //MAX_LEDS_PER_STRIP;
+#define nROWs              10  //number of rows per cube panel 
+#define nCOLs              10  //number of columns per cube panel
+#define DATA_OUT_PIN1      2   // PTD2
+#define DATA_OUT_PIN2      3   // PTD3 
 
 
 LedCube::LedCube():X(0),Y(1),Z(2),ledStrip1(nLEDs, DATA_OUT_PIN1),ledStrip2(nLEDs, DATA_OUT_PIN2)
@@ -33,6 +33,7 @@
 {
 }
 
+/*Sets the initial size and position of the lighted cube*/ 
 void LedCube::Init(int x, int y, int z)
 {
     size = 2;
@@ -51,6 +52,10 @@
     ledStrip2.begin();
 }
 
+/*Determines which LED should be lit based on its 
+cartesian coordinate. The origin is the led at
+bottom left of panel 0 when using a three cube panel.  */
+
 int LedCube::getLedIndex(int panel, int x, int y) {
     if (panel == PANEL1) {
         if (y % 2 == 0) {
@@ -222,4 +227,14 @@
     if((pos[X] + newSize) < nCOLs && (pos[Y] + newSize) < nCOLs && (pos[Z] + newSize) < nCOLs) {
         size = newSize;
     }
-}
\ No newline at end of file
+}
+
+void LedCube::UpdateCube(int size, int deltaX, int deltaY, int deltaZ, float hue) {
+     changeSize(size);
+     move(deltaX, deltaY, deltaZ); 
+     changeColor(hue); 
+     cubeUpdate(); 
+}
+
+
+