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: simple-mbed-client
Fork of simple-mbed-client-example by
Diff: main.cpp
- Revision:
- 11:341c9f62028b
- Parent:
- 4:dcd0494556be
- Child:
- 12:31e60c8bb7f6
--- a/main.cpp Fri Feb 19 17:50:40 2016 +0000
+++ b/main.cpp Thu Mar 03 19:26:28 2016 +0000
@@ -24,6 +24,10 @@
#include "ns_trace.h"
#include "mbed.h"
+#include "rtos.h"
+
+#include "ESP8266Interface.h"
+#include "mbed-client-classic/m2mnetwork.h"
Serial output(USBTX, USBRX);
@@ -292,14 +296,15 @@
int _value;
};
-EthernetInterface eth;
// Instantiate the class which implements
// LWM2M Client API
MbedClient mbed_client;
+ESP8266Interface esp(D1, D0);
+M2MNetwork network(&esp);
// Set up Hardware interrupt button.
-InterruptIn obs_button(OBS_BUTTON);
-InterruptIn unreg_button(UNREG_BUTTON);
+InterruptIn obs_button(SW2);
+InterruptIn unreg_button(SW3);
// Network interaction must be performed outside of interrupt context
Semaphore updates(0);
@@ -317,7 +322,7 @@
// Status indication
Ticker status_ticker;
-DigitalOut status_led(LED_GREEN);
+DigitalOut status_led(LED1);
void blinky() { status_led = !status_led; }
@@ -333,11 +338,10 @@
// This sets up the network interface configuration which will be used
// by LWM2M Client API to communicate with mbed Device server.
- eth.init(); //Use DHCP
- eth.connect();
+ esp.connect("Sniffer", "Sandcastle");
//lwipv4_socket_init();
- output.printf("IP address %s\r\n", eth.getIPAddress());
+ output.printf("IP address %s\r\n", esp.getIPAddress());
// On press of SW3 button on K64F board, example application
// will call unregister API towards mbed Device Server
