Nathaniel Honka / Mbed 2 deprecated Data-Management-Honka

Dependencies:   ExoController MODSERIAL SDFileSystem_HelloWorld UI-Honka mbed

Fork of Data Management by HEL's Angels

Revision:
0:cbb61997e231
Child:
1:78452728a306
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 15 18:44:04 2014 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+#include "MODSERIAL.h"
+#include "initDatabed.h"
+#include "UI.h"
+
+Timer t_debug;
+
+int main()
+{
+    int dataIn[2], dataOut[2];
+    dataOut[0]=1;
+    dataOut[1]=2;
+    mainPower=0;//Don't turn on for initial testing
+    initializeDatabed();
+    comm.reply(dataOut[0]);//make this the first message
+    pc.printf("DataBed On!\r\n");
+    int counter=0;
+    //float blah=1;
+    //t_debug.start();
+    while (1) { //Run these functions as fast as possible
+        if(comm.receive()) {
+            //t_debug.reset();
+            dataIn[0] = comm.read();//Read the SPI buffer
+            if(dataIn[0]==75) {
+                comm.reply(dataOut[1]);// Make this the next reply
+                dataIn[1]=comm.read();//Read the SPI buffer
+                //pc.printf("T");
+            }
+            if(counter>=100) {
+                UI=0;//set the UI to 0 unless it's changed in checkUI_Xbee()
+                readBuffer();
+                checkUI_XBee(); //check UI from Xbee
+                counter=0;
+            }
+            //dataOut[0]=UI;
+            comm.reply(dataOut[0]);//Set the communication for the next round
+            pc.printf("Data: %d, %d,\r\n", dataIn[0], dataIn[1]);
+            counter++;
+            //blah=t_debug.read_us();
+            //pc.printf("UI: %d\r\n", UI);
+            //pc.printf("T: %f \r\n ", blah);
+        }
+    }
+}
\ No newline at end of file