02/07/15

Dependencies:   mbed

Dependents:   TabbedGUIMbed

main.cpp

Committer:
aidanPJG
Date:
2015-08-27
Revision:
69:74bffa1d3f7f
Parent:
68:c6399471ea49
Child:
70:168d67695a65

File content as of revision 69:74bffa1d3f7f:

#include "mbed.h"
#include "Calculate.h"
#include "Data.h"
#include "UserInput.h"
#include "AddDetails.h"

Serial pc(USBTX, USBRX); // tx, rx 
DigitalOut led1(LED1);
DigitalOut led2(LED2);
string handshake();
void run();
int listen();

int main(void)
{
   
    if (handshake() == "success")
    {
        run();
    }      
    led2= 1;
}

string handshake()
{
            unsigned char input;
             pc.printf("a\n");
          
                 while(true)
                 {
                     input = pc.getc();
                     if (input == 'a')
                     {
                         led1 = 1; 
                        return "success" ;// run();
                     }
                 }
}
void run()
{
    int pins =  inputNoOfPins();                //gets number of pins
    double distance = inputDistance();         //gets the distance between the pins
    calculate(distance,pins);    
}