![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Kuo Yiching
Fork of iot_example by
Diff: main.cpp
- Revision:
- 0:63af4719467f
- Child:
- 1:3b487c4813a2
--- /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); + } +}