endpoint including temperature and distance sensors

Dependencies:   mbed mbedConnectorInterface mbedEndpointNetwork TrashSensors

Fork of TempAndDistTest by Tim Ambrose

Committer:
coyotebush
Date:
Mon May 25 03:21:11 2015 +0000
Revision:
11:ac0ff76a6deb
Parent:
8:c69fe28366d8
Move sensor code into library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
coyotebush 7:939fdc8df95b 1 #include "DistanceResource.h"
coyotebush 7:939fdc8df95b 2
coyotebush 7:939fdc8df95b 3 string DistanceResource::get() {
coyotebush 7:939fdc8df95b 4 char buf[10];
coyotebush 8:c69fe28366d8 5 double dist;
coyotebush 7:939fdc8df95b 6 sensor->start();
coyotebush 8:c69fe28366d8 7 while ((dist = sensor->get_dist_cm()) < 0)
coyotebush 8:c69fe28366d8 8 ;
coyotebush 8:c69fe28366d8 9 //wait_ms(500);
coyotebush 8:c69fe28366d8 10 snprintf(buf, 10, "%0.2f", dist);
coyotebush 7:939fdc8df95b 11 return string(buf);
coyotebush 7:939fdc8df95b 12 }