update
Dependencies: C12832_lcd EthernetInterface HTTPClient LM75B mbed-rtos mbed
Revision 0:bd54851642ed, committed 2018-03-13
- Comitter:
- MohamadNazrin
- Date:
- Tue Mar 13 07:11:21 2018 +0000
- Commit message:
- HTTPclient
Changed in this revision
diff -r 000000000000 -r bd54851642ed C12832_lcd.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832_lcd.lib Tue Mar 13 07:11:21 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/dreschpe/code/C12832_lcd/#8f86576007d6
diff -r 000000000000 -r bd54851642ed EthernetInterface.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetInterface.lib Tue Mar 13 07:11:21 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/MohamadNazrin/code/EthernetInterface/#3b4a8d2e1539
diff -r 000000000000 -r bd54851642ed HTTPClient.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTTPClient.lib Tue Mar 13 07:11:21 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/HTTPClient/#cca5d89e6a2b
diff -r 000000000000 -r bd54851642ed LM75B.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LM75B.lib Tue Mar 13 07:11:21 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/chris/code/LM75B/#6a70c9303bbe
diff -r 000000000000 -r bd54851642ed main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Mar 13 07:11:21 2018 +0000 @@ -0,0 +1,46 @@ +#include "mbed.h" +#include "EthernetInterface.h" +#include "LM75B.h" +#include "HTTPClient.h" +#include "C12832_lcd.h" // Include for LCD code + +LM75B tmp(p28,p27); // temperature sensor +char* Server = "http://192.168.1.108/IoT/api_update.php"; +char* id = "1"; + +char buffer[256]; +C12832_LCD lcd; //Initialize LCD Screen + + +void ethernetSetup(){ + 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 + +EthernetInterface eth; + // eth.init(); //Use DHCP + eth.init(mbedIp,mbedMask,mbedGateway); + eth.connect(); + printf("IP Address is %s\n", eth.getIPAddress()); // display at terminal + lcd.printf("IP address: %s \n",eth.getIPAddress()); // display LCD screen + + } + +void sendToServer(){ + HTTPClient http; + buffer[0] = 0; + sprintf(buffer,"%s?id=%s&data=%2f",Server,id,tmp.read()); + printf("Send to %s\r\n", buffer); + http.get(buffer, buffer , 10); // Execute the URL of urlBuffer + // lcd.printf("Send: %s \n",buffer); + } + +int main() { + ethernetSetup(); + sendToServer(); + while(1) { + wait(0.5); + sendToServer(); + wait(0.5); + } +}
diff -r 000000000000 -r bd54851642ed mbed-rtos.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Tue Mar 13 07:11:21 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#5dfe422a963d
diff -r 000000000000 -r bd54851642ed mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Mar 13 07:11:21 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file