02/07/15

Dependencies:   mbed

Dependents:   TabbedGUIMbed

UserInput.cpp

Committer:
aidanPJG
Date:
2015-07-15
Revision:
49:889751dd0395
Parent:
48:e9578f56534a
Child:
50:d794595c6868

File content as of revision 49:889751dd0395:

#include "mbed.h"

extern Serial pc;
int sensorNumber;
double sensorDistance;

float input(){
    pc.printf("Ready to Read.\n");
    pc.printf("Enter the number of sensors\n");
    while (1){
                if (pc.readable())
                {
                    pc.scanf("%d", &sensorNumber);                  
                    pc.printf("Enter the distance between each sensor\n ");
                    pc.scanf("%lf", &sensorDistance);                           //has to &lf because must know the size of it before getting it in
                    break;
                    }
            }
        pc.printf("sensorNumber : %d \t sensorDistance : %f", sensorNumber, sensorDistance ); 
       return(sensorNumber, sensorDistance);
    }