I’m try to connect to Thingspeak using Atcommand
I connected successfully to the site but "GET /update?api_key=&field1=143"
not write any thing on the field .I used _parser->write (GET /update?api_key=&field1=143);
to send the data is it write or need to used another command
include "mbed.h"
#include "platform\ATCmdParser.h"
#include "drivers\UARTSerial.h"
#include <string>
#define ESP8266_DEFAULT_BAUD_RATE 115200
#define ESP32_AT_ECHO_OFF "ATE0"
#define ESP32_AT "AT"
#define ESP32_AT_VERSION "AT+GMR"
#define ESP32_AT_RST "AT+RST"
#define ESP32_AT_MODE_STATION "AT+CWMODE_CUR=1"
#define ESP32_AT_MODE_AP "AT+CWMODE_CUR=2"
#define ESP32_AT_MODE_AP_STATION "AT+CWMODE_CUR=3"
#define ESP32_AT_CPONECT_AP "AT+CWJAP=\"WLAN-8RM8KE\",\"75759746464185958228\""
#define ESP32_AT_CREATE_AP "AT+CWSAP_CUR=\"21FAPCTDV01\",\"123456789\",1,2"
#define ESP32_AT_LIST_AP "AT+CWLAP"
#define ESP32_AT_GET_IP " AT+CIFSR"
#define ESP32_AT_CONN_MODE_SINGLE "AT+CIPMUX=0"
#define ESP32_AT_TCP_CONN "AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",80"
#define ESP32_AT_DATA_LENGTH "AT+CIPSEND=51"
#define ESP32_DATA "GET /update?api_key=681VDNKCSXQDA4M2&field2=143 "
#define ESP32_AT_TCP_CONN_CLOSE "AT+CIPCLOSE"
#define ESP32_AT_OK_STATUS "OK"
UARTSerial *_serial;
ATCmdParser *_parser;
const char *at_cmd[] = {ESP32_AT,
ESP32_AT_VERSION,
ESP32_AT_MODE_AP_STATION,
ESP32_AT_CPONECT_AP,
ESP32_AT_GET_IP,
ESP32_AT_CONN_MODE_SINGLE,
ESP32_AT_TCP_CONN,
ESP32_AT_DATA_LENGTH} ;
int main()
{
int command_index = 0;
// printf("\nATCmdParser with ESP8266 example");
_serial = new UARTSerial( PB_1, PB_0, ESP8266_DEFAULT_BAUD_RATE);
_parser = new ATCmdParser(_serial);
_parser->debug_on( 1 );
_parser->set_delimiter( "\r\n" );
while(command_index < sizeof(at_cmd) / sizeof(at_cmd[0]))
{
if ( (_parser->send(at_cmd[command_index])== TRUE ) && _parser->recv("OK")== TRUE )
{
printf("AT command send Successfully\n" );
command_index++;
}
else
{
printf("send AT command failed\n" );
command_index =0;
return -1;
}
}
_parser->write("GET /update?api_key=********************&field1=143");
_parser->send (ESP32_AT_TCP_CONN_CLOSE);
// printf("\nDone\n");
}