yet another 18B20 Temperature sensor. variable number of sensors working in parasite mode, serial 16x2 display with diagnostic output and post to a rest web service
Dependencies: EthernetInterface HTTPClient NTPClient mbed-rtos mbed
Diff: switch_sensor.cpp
- Revision:
- 1:9e88b2508768
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/switch_sensor.cpp Thu Jan 03 18:50:43 2013 +0000 @@ -0,0 +1,14 @@ +#include "switch_sensor.h" + +SwitchSensor::SwitchSensor(PinName pin, char *url_part, char *name): Sensor('S', pin, url_part, name), input(pin) { +} + +void SwitchSensor::measure(void) { + value = input; +} + +char *SwitchSensor::last_measure(void) { + sprintf(buffer, "%s", value ? "EIN" : "AUS"); + + return buffer; +}