02/07/15
Dependencies: mbed
Diff: UserInput.cpp
- Revision:
- 48:e9578f56534a
- Child:
- 49:889751dd0395
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UserInput.cpp Mon Jul 13 14:44:08 2015 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" + +extern Serial pc; +int sensorNumber; +float 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("%f", &sensorDistance); + break; + } + } + pc.printf("sensorNumber : %f \t sensorDistance : %d", sensorNumber, sensorDistance ); + return(sensorNumber, sensorDistance); + } \ No newline at end of file