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
donatien 0:bb128f0e952f 1 #include "mbed.h"
sillevl 16:58c33ec28b2a 2 #include "TempDashSocketConnection.h"
sillevl 16:58c33ec28b2a 3 #include "TemperatureSensor.h"
sillevl 16:58c33ec28b2a 4 #include <string.h>
sillevl 16:58c33ec28b2a 5
sillevl 16:58c33ec28b2a 6 Serial pc(USBTX, USBRX); // tx, rx
sillevl 16:58c33ec28b2a 7
gimohd 17:c8a4886ba688 8 std::string key = "c74d97b01eae257e44aa9d5bade97baf";
gimohd 17:c8a4886ba688 9 std::string name = "kristof";
sillevl 16:58c33ec28b2a 10 static const char SERVER[] = "labict.be";
sillevl 16:58c33ec28b2a 11 static const int PORT = 45678;
donatien 0:bb128f0e952f 12
emilmont 7:65188f4a8c25 13 int main() {
sillevl 16:58c33ec28b2a 14 pc.baud(115200);
donatien 0:bb128f0e952f 15 EthernetInterface eth;
donatien 0:bb128f0e952f 16 eth.init(); //Use DHCP
donatien 0:bb128f0e952f 17 eth.connect();
sillevl 16:58c33ec28b2a 18 pc.printf("IP Address is %s\r\n", eth.getIPAddress());
donatien 0:bb128f0e952f 19
sillevl 16:58c33ec28b2a 20 TemperatureSensor sensor(p28, p27, key, name);
donatien 0:bb128f0e952f 21
sillevl 16:58c33ec28b2a 22 TempDashSocketConnection sock;
emilmont 7:65188f4a8c25 23
sillevl 16:58c33ec28b2a 24 while(1) {
sillevl 16:58c33ec28b2a 25 if (sensor.open()) {
sillevl 16:58c33ec28b2a 26 sock.connect(SERVER, PORT);
sillevl 16:58c33ec28b2a 27 sock.sendSensorData(sensor.getDataPacket());
sillevl 16:58c33ec28b2a 28 sock.close();
sillevl 16:58c33ec28b2a 29 wait(1.0);
sillevl 16:58c33ec28b2a 30 }
emilmont 7:65188f4a8c25 31 }
emilmont 7:65188f4a8c25 32 eth.disconnect();
donatien 0:bb128f0e952f 33 }