start project for students
Dependencies: EthernetInterface mbed-rtos mbed
Fork of TCPSocket_HelloWorld by
main.cpp
- Committer:
- sillevl
- Date:
- 2014-11-07
- Revision:
- 16:58c33ec28b2a
- Parent:
- 11:59dcefdda506
File content as of revision 16:58c33ec28b2a:
#include "mbed.h" #include "TempDashSocketConnection.h" #include "TemperatureSensor.h" #include <string.h> Serial pc(USBTX, USBRX); // tx, rx std::string key = ""; std::string name = "mbed"; static const char SERVER[] = "labict.be"; static const int PORT = 45678; int main() { pc.baud(115200); EthernetInterface eth; eth.init(); //Use DHCP eth.connect(); pc.printf("IP Address is %s\r\n", eth.getIPAddress()); TemperatureSensor sensor(p28, p27, key, name); TempDashSocketConnection sock; while(1) { if (sensor.open()) { sock.connect(SERVER, PORT); sock.sendSensorData(sensor.getDataPacket()); sock.close(); wait(1.0); } } eth.disconnect(); }