Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: W5500Interface mbed
Fork of AxedaGo-mbedNXP_WIZ550io by
Revision 0:ab4e84579da0, committed 2013-10-09
- Comitter:
- AxedaCorp
- Date:
- Wed Oct 09 19:25:56 2013 +0000
- Child:
- 1:16dd56f0f6c7
- Commit message:
- First Commit of demo code to Axeda Corp account
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetInterface.lib Wed Oct 09 19:25:56 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/EthernetInterface/#cba86db5ab96
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Oct 09 19:25:56 2013 +0000
@@ -0,0 +1,87 @@
+#include "mbed.h"
+#include "EthernetInterface.h"
+
+EthernetInterface eth;
+
+AnalogIn pot1(p19);
+TCPSocketConnection sock;
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+int main()
+{
+
+ char *MODEL = "mbed";
+ char *SERIAL_NUM = "abc-123-ume";
+ float DEADBAND = 0.015;
+
+ char* ip;
+
+ char http_cmd[300];
+ char buffer[300];
+ int returnCode = 0;
+
+ led1 = 1;
+ led2 = 1;
+ led3 = 1;
+ led4 = 1;
+
+ printf("initializing Ethernet\r\n");
+ returnCode = eth.init(); //Use DHCP
+
+ if ( returnCode == 0 )
+ {
+ printf(" - Ethernet ready\r\n");
+ led1 = returnCode;
+ }
+ else
+ {
+ printf(" - Could not initialize Ethernet - ending\r\n");
+ return 0;
+ }
+
+ printf("Ethernet.connecting \r\n");
+ returnCode = eth.connect();
+ printf(" - connecting returned %d \r\n", returnCode);
+ led2 = returnCode != -1 ? 0: 1;
+ printf("Trying to get IP address..\r\n");
+ ip = eth.getIPAddress();
+ led3 = strlen(ip)<4 ? 1: 0;
+ printf(" - IP address:%s\r\n", ip);
+
+ float potVal = 0.0;
+ float oldPotVal = -2.0;
+
+ while(1) {
+
+ potVal = pot1.read();
+
+ if ( abs(potVal - oldPotVal) < DEADBAND)
+ {
+ continue;
+ }
+ else
+ {
+ led4 = 1;
+ oldPotVal = potVal;
+ printf("Sending Value %.2f\n\r", potVal);
+ sock.connect("dev6-connect.axeda.com", 52689);
+
+ sprintf(http_cmd, "POST /axeda/data/%s!%s HTTP/1.1\r\nContent-Type: application/vnd.m2m.msgbuf-v1+json\r\nContent-Length: 49\r\n\r\n{\"data\":[{\"items\":{\"bar\":\"camp\",\"pot1\":%.2f}}]}\r\n\r\n", MODEL, SERIAL_NUM,potVal);
+ sock.send_all(http_cmd, sizeof(http_cmd)-1);
+
+ while ( (returnCode = sock.receive(buffer, sizeof(buffer)-1)) > 0)
+ {
+ buffer[returnCode] = '\0';
+ printf("Received %d chars from server:\n\r%s\n", returnCode, buffer);
+ }
+ led4 = returnCode;
+ sock.close();
+ }
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Wed Oct 09 19:25:56 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#ee87e782d34f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Oct 09 19:25:56 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file
