Keegan Hu
/
warehouse
init
Fork of 仓库 by
main.cpp
- Committer:
- zhangyx
- Date:
- 2017-11-07
- Revision:
- 1:3b487c4813a2
- Parent:
- 0:63af4719467f
- Child:
- 2:b10925c474fc
File content as of revision 1:3b487c4813a2:
/*----------------------------------------------------- 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 相连接的串口,WiFi 名称和密码 // 参数分别为 TX pin / RX pin / SSID / Password Esp8266 client(PC_10, PC_11, "TSINGHUA.iCenter", "TS.icenter"); 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); } }