![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Use ESP8266 to connect ThingSpeak.com
Drive to connect with ThingSpeak.com,
it`s work well, but it don`t provided return message
you can send "int" "float" "char".
ESP8266和ThingSpeak.com的驱动,工作正常,但是驱动不提供ESP8266的返回消息
Diff: main.cpp
- Revision:
- 0:1432a364e32a
- Child:
- 1:6df8ccaec251
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Feb 14 07:51:08 2019 +0000 @@ -0,0 +1,42 @@ +#include "mbed.h" +#include "ThingSpeak_ESP8266.h" + +#define SSID "DAYANGFUZHUANGCHENG" +#define Password "duyifan98" +#define API_Key "FTXMXNNNVY0LZ2IS" + +Serial PC(USBTX, USBRX, 115200); +ESP8266 WIFI(PC_10, PC_11, 115200); + +void WIFI_init(void); + +int main(void) +{ + int data = 0; + + WIFI_init(); + WIFI.User_API_Key = API_Key; + + while(1) + { + PC.printf("Send %2d", data); + WIFI.Send_To_ThingSpeak_int(1, data); + PC.printf(" Done\r\n"); + + data++; + wait(5); + } +} + +void WIFI_init(void) +{ + printf("\r\nReset ESP..."); + WIFI.Reset(); + + printf("\r\nSet Mode..."); + WIFI.Set_Mode(); + + printf("\r\nConnect WIFI...."); + WIFI.Connect_WIFI(SSID, Password); +} +