Temperature Monitoring with thingspeak (IoT)
Dependencies: HTTPClient LM75B mbed-rtos mbed
Fork of TCPSocket_HelloWorld by
Diff: main.cpp
- Revision:
- 15:bc7fc13dc5f6
- Parent:
- 11:59dcefdda506
- Child:
- 16:91200554b881
--- a/main.cpp Wed May 14 15:07:26 2014 +0000 +++ b/main.cpp Fri Feb 09 02:19:29 2018 +0000 @@ -1,31 +1,16 @@ #include "mbed.h" #include "EthernetInterface.h" +int main() { + +static const char* mbedIp = "192.168.137.2"; //IP +static const char* mbedMask = "255.255.255.0"; // Mask +static const char* mbedGateway = "192.168.137.1"; //Gateway -int main() { EthernetInterface eth; - eth.init(); //Use DHCP + // eth.init(); //Use DHCP + eth.init(mbedIp,mbedMask,mbedGateway); eth.connect(); printf("IP Address is %s\n", eth.getIPAddress()); - - TCPSocketConnection sock; - sock.connect("mbed.org", 80); - - char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n"; - sock.send_all(http_cmd, sizeof(http_cmd)-1); - - char buffer[300]; - int ret; - while (true) { - ret = sock.receive(buffer, sizeof(buffer)-1); - if (ret <= 0) - break; - buffer[ret] = '\0'; - printf("Received %d chars from server:\n%s\n", ret, buffer); - } - - sock.close(); - - eth.disconnect(); - + while(1) {} }