![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
init
Fork of 仓库 by
main.cpp
- Committer:
- zhangyx
- Date:
- 2017-11-07
- Revision:
- 2:b10925c474fc
- Parent:
- 1:3b487c4813a2
- Child:
- 3:06080fa094a0
File content as of revision 2:b10925c474fc:
/*----------------------------------------------------- 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("pressure", "12345"); 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); } }