endpoint including temperature and distance sensors

Dependencies:   mbed mbedConnectorInterface mbedEndpointNetwork TrashSensors

Fork of TempAndDistTest by Tim Ambrose

resource/DistanceResource.cpp

Committer:
coyotebush
Date:
2015-05-06
Revision:
8:c69fe28366d8
Parent:
7:939fdc8df95b

File content as of revision 8:c69fe28366d8:

#include "DistanceResource.h"

string DistanceResource::get() {
    char buf[10];
    double dist;
    sensor->start();
    while ((dist = sensor->get_dist_cm()) < 0)
        ;
    //wait_ms(500);
    snprintf(buf, 10, "%0.2f", dist);
    return string(buf);
}