02/07/15

Dependencies:   mbed

Dependents:   TabbedGUIMbed

Committer:
aidanPJG
Date:
Wed Jul 15 15:16:03 2015 +0000
Revision:
50:d794595c6868
Parent:
49:889751dd0395
Child:
54:9322b1b76e13
fiddling about with printArray. now prints a summary including speed. Going to add speed to xl now;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aidanPJG 48:e9578f56534a 1 #include "mbed.h"
aidanPJG 48:e9578f56534a 2
aidanPJG 48:e9578f56534a 3 extern Serial pc;
aidanPJG 48:e9578f56534a 4 int sensorNumber;
aidanPJG 49:889751dd0395 5 double sensorDistance;
aidanPJG 48:e9578f56534a 6
aidanPJG 50:d794595c6868 7 double input(){
aidanPJG 48:e9578f56534a 8 pc.printf("Ready to Read.\n");
aidanPJG 48:e9578f56534a 9 pc.printf("Enter the number of sensors\n");
aidanPJG 48:e9578f56534a 10 while (1){
aidanPJG 48:e9578f56534a 11 if (pc.readable())
aidanPJG 48:e9578f56534a 12 {
aidanPJG 48:e9578f56534a 13 pc.scanf("%d", &sensorNumber);
aidanPJG 48:e9578f56534a 14 pc.printf("Enter the distance between each sensor\n ");
aidanPJG 49:889751dd0395 15 pc.scanf("%lf", &sensorDistance); //has to &lf because must know the size of it before getting it in
aidanPJG 48:e9578f56534a 16 break;
aidanPJG 48:e9578f56534a 17 }
aidanPJG 48:e9578f56534a 18 }
aidanPJG 49:889751dd0395 19 pc.printf("sensorNumber : %d \t sensorDistance : %f", sensorNumber, sensorDistance );
aidanPJG 50:d794595c6868 20 return(sensorDistance);
aidanPJG 48:e9578f56534a 21 }