Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ExoController MODSERIAL SDFileSystem_HelloWorld UI-Honka mbed
Fork of Data Management by
Diff: main.cpp
- Revision:
- 1:78452728a306
- Parent:
- 0:cbb61997e231
- Child:
- 2:b87aaf1bc803
--- a/main.cpp	Wed Oct 15 18:44:04 2014 +0000
+++ b/main.cpp	Thu Oct 16 00:49:21 2014 +0000
@@ -8,8 +8,8 @@
 int main()
 {
     int dataIn[2], dataOut[2];
-    dataOut[0]=1;
-    dataOut[1]=2;
+    dataOut[0]=7;
+    dataOut[1]=30;
     mainPower=0;//Don't turn on for initial testing
     initializeDatabed();
     comm.reply(dataOut[0]);//make this the first message
@@ -18,13 +18,17 @@
     //float blah=1;
     //t_debug.start();
     while (1) { //Run these functions as fast as possible
-        if(comm.receive()) {
+        /*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");
+
+            while(dataIn[0]==75) {
+                if(comm.receive()) {
+                    //comm.reply(dataOut[1]);// Make this the next reply
+                    dataIn[1]=comm.read();//Read the SPI buffer
+                    //pc.printf("T");
+                    break;
+                }
             }
             if(counter>=100) {
                 UI=0;//set the UI to 0 unless it's changed in checkUI_Xbee()
@@ -35,10 +39,25 @@
             //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++;
+            comm.reply(dataOut[1]);// Make this the next repl
+            //counter++;
             //blah=t_debug.read_us();
             //pc.printf("UI: %d\r\n", UI);
             //pc.printf("T: %f \r\n ", blah);
+            
+        }*/
+        if(comm.receive()) {
+            dataIn[0] = comm.read();
+            comm.reply(28);         // Make this the next reply
+            while(dataIn[0]==7) {
+                if(comm.receive()) {
+                    dataIn[1]=comm.read();
+                    comm.reply(5);
+                    pc.printf("Data1: %u, Data2: %u\n\r", dataIn[0], dataIn[1]);
+                    dataIn[0]=0;
+                    break;
+                }
+            }
         }
     }
 }
\ No newline at end of file
    