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.
Fork of iot_example by
Diff: main.cpp
- Revision:
- 0:63af4719467f
- Child:
- 1:3b487c4813a2
diff -r 000000000000 -r 63af4719467f main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Oct 11 08:40:04 2017 +0000
@@ -0,0 +1,33 @@
+/*-----------------------------------------------------
+ File Name : main.cpp
+ Purpose : For esp8266 mbed porting
+ Creation Date : 22-06-2017
+ Last Modified :
+ Created By : Jeasine Ma [jeasinema[at]gmail[dot]com]
+-----------------------------------------------------*/
+#include <cstdarg>
+#include <cstring>
+#include "mbed.h"
+#include "esp8266.h"
+
+
+Serial ser2usb(USBTX, USBRX);
+
+int main(void) {
+ Esp8266 client(0);
+ client.connect_mqtt_broker("tdxls-iot.xicp.net");
+ ser2usb.printf("Initialization done.\r\n");
+
+ while(1) {
+ client.publish("/smartcar", "awesome smartcar!");
+ client.publish("/smartcar", "awesome smartcar!");
+ wait(1);
+ //char buf[32];
+ //client.subscribe_poll("/icenter", buf, 32);
+ //ser2esp8266.attach(simple_callback, Serial::RxIrq);
+ //ser2usb.printf("%s\r\n", esp_paramBuf);
+ //ser2usb.printf("loop\r\n");
+ //ser2usb.printf("haha\n");
+ //while(1);
+ }
+}
