Pipeline Technology Centre / Mbed 2 deprecated ConsolTest

Dependencies:   mbed

Dependents:   TabbedGUIMbed

Committer:
ADAMSTRUTT
Date:
Tue Jul 07 12:37:34 2015 +0000
Revision:
20:0b2279011691
Parent:
17:d9fb4a3780c7
Child:
24:92600b1d15b1
Before merge

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ADAMSTRUTT 17:d9fb4a3780c7 1 #include "mbed.h"
ADAMSTRUTT 15:a468af6ba5a4 2
ADAMSTRUTT 20:0b2279011691 3 Serial pc(USBTX, USBRX);//tx, rx
ADAMSTRUTT 20:0b2279011691 4
ADAMSTRUTT 20:0b2279011691 5 float radius;
ADAMSTRUTT 20:0b2279011691 6 float distance;
ADAMSTRUTT 15:a468af6ba5a4 7
ADAMSTRUTT 15:a468af6ba5a4 8 float Distance(){
ADAMSTRUTT 20:0b2279011691 9 pc.printf("Ready to Read\n");
ADAMSTRUTT 15:a468af6ba5a4 10 while (1){
ADAMSTRUTT 20:0b2279011691 11 if (pc.readable()){
ADAMSTRUTT 20:0b2279011691 12 pc.printf("Radius has been resived ");
ADAMSTRUTT 20:0b2279011691 13 pc.scanf("%f", &radius);//resives the radius from the PC
ADAMSTRUTT 20:0b2279011691 14 distance = radius+2;
ADAMSTRUTT 20:0b2279011691 15 break;
ADAMSTRUTT 20:0b2279011691 16 }
ADAMSTRUTT 15:a468af6ba5a4 17 }
ADAMSTRUTT 20:0b2279011691 18 pc.printf("and distance has be calulated\n");
ADAMSTRUTT 20:0b2279011691 19 return(distance);//returns the distance in as a float
ADAMSTRUTT 20:0b2279011691 20 }