YX ZHANG
/
iot_example
IoT demo
Fork of my_example_esp8266 by
main.cpp
- Committer:
- brainliang
- Date:
- 2017-10-11
- Revision:
- 0:63af4719467f
- Child:
- 1:3b487c4813a2
File content as of revision 0:63af4719467f:
/*----------------------------------------------------- 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); } }