Temperature dashboard assignment

Dependencies:   EthernetInterface LM75B mbed-rtos mbed

Fork of temperature-dashboard-start by Sille Van Landschoot

Committer:
gimohd
Date:
Sat Jan 16 21:11:01 2016 +0000
Revision:
18:61724d00e95d
Parent:
17:c8a4886ba688
upd

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gimohd 17:c8a4886ba688 1 #include "TemperatureSensor.h"
gimohd 17:c8a4886ba688 2 #include "LM75B.h"
gimohd 17:c8a4886ba688 3 #include <mbed.h>
gimohd 17:c8a4886ba688 4 #include <string>
gimohd 17:c8a4886ba688 5
gimohd 17:c8a4886ba688 6
gimohd 17:c8a4886ba688 7 TemperatureSensor::TemperatureSensor(PinName sca, PinName scl, std::string key, std::string name)
gimohd 17:c8a4886ba688 8 :LM75B(sca,scl){
gimohd 17:c8a4886ba688 9 this->key = key;
gimohd 17:c8a4886ba688 10 this->name = name;
gimohd 17:c8a4886ba688 11 this->sca = sca;
gimohd 17:c8a4886ba688 12 this->scl = scl;
gimohd 17:c8a4886ba688 13 }
gimohd 17:c8a4886ba688 14
gimohd 17:c8a4886ba688 15 std::string TemperatureSensor::getDataPacket(){
gimohd 17:c8a4886ba688 16 char buffer[100];
gimohd 17:c8a4886ba688 17 sprintf(buffer,"{\"key\":\"%s\",\"title\":\"%s\",\"temperature\":\"%f\"}", key.c_str(), name.c_str(), temp());
gimohd 17:c8a4886ba688 18 return string(buffer);
gimohd 17:c8a4886ba688 19 }