Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Distance.cpp
- Committer:
- aidanPJG
- Date:
- 2015-07-07
- Revision:
- 25:bab86a12e9ad
- Parent:
- 24:92600b1d15b1
- Child:
- 27:f3ca0269515f
File content as of revision 25:bab86a12e9ad:
#include "mbed.h"
extern Serial pc;
float radius;
float distance;
float Distance(){
pc.printf("Ready to Read\n");
while (1){
if (pc.readable()){
pc.printf("Radius has been resived ");
pc.scanf("%f", &radius);//resives the radius from the PC
distance = radius+2;
break;
}
}
pc.printf("and distance has be calulated\n");
return(distance);//returns the distance in as a float
}