![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
02/07/15
Dependencies: mbed
UserInput.cpp
- Committer:
- aidanPJG
- Date:
- 2015-07-16
- Revision:
- 54:9322b1b76e13
- Parent:
- 50:d794595c6868
- Child:
- 56:bf08d9e50ccc
File content as of revision 54:9322b1b76e13:
#include "mbed.h" #include <utility> extern Serial pc; int sensorNumber; double sensorDistance; int inputNoOfPins(){ pc.printf("Ready to Read.\n"); pc.printf("Enter the number of sensors\n"); while (1){ if (pc.readable()) { pc.scanf("%d", &sensorNumber); break; } } pc.printf("sensorNumber : %d \t " ,sensorNumber ); return(sensorNumber); } double inputDistance(){ pc.printf("Enter the distance between each sensor\n "); while (1){ if (pc.readable()) { pc.scanf("%lf", &sensorDistance); //has to &lf because must know the size of it before getting it in break; } } pc.printf( "SensorDistance : %f", sensorDistance ); return(sensorDistance); }