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:
- 2:b87aaf1bc803
- Parent:
- 1:78452728a306
- Child:
- 3:ef7e0cbade6d
--- a/main.cpp Thu Oct 16 00:49:21 2014 +0000
+++ b/main.cpp Sat Nov 22 00:58:11 2014 +0000
@@ -7,10 +7,10 @@
int main()
{
- int dataIn[2], dataOut[2];
+ int dataIn[3], dataOut[3];
dataOut[0]=7;
dataOut[1]=30;
- mainPower=0;//Don't turn on for initial testing
+ mainPower=1;//Don't turn on for initial testing
initializeDatabed();
comm.reply(dataOut[0]);//make this the first message
pc.printf("DataBed On!\r\n");
@@ -18,15 +18,25 @@
//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
- while(dataIn[0]==75) {
+ if(comm.receive()) {
+ dataIn[0] = comm.read();
+ comm.reply(UI); // Make this the next reply
+ while(dataIn[0]==7) {
if(comm.receive()) {
- //comm.reply(dataOut[1]);// Make this the next reply
- dataIn[1]=comm.read();//Read the SPI buffer
- //pc.printf("T");
+ dataIn[1]=comm.read();
+ comm.reply(22);
+ break;
+ dataIn[0]=0;
+ }
+ }
+ while(dataIn[1]==30) {
+ if(comm.receive()) {
+ dataIn[2]=comm.read();
+ comm.reply(5);
+ pc.printf("Fault: %d, %d ", leftFault.read(), rightFault.read());
+ pc.printf("Data1: %u, Data2: %u, Data3: %u\r\n", dataIn[0], dataIn[1], dataIn[2]);
+ dataIn[1]=0;
break;
}
}
@@ -36,28 +46,8 @@
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]);
- 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;
- }
- }
+ counter++;
}
+
}
}
\ No newline at end of file
