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
main.cpp
- Committer:
- perr1940
- Date:
- 2014-10-15
- Revision:
- 0:cbb61997e231
- Child:
- 1:78452728a306
File content as of revision 0:cbb61997e231:
#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);
        }
    }
}
            
    