Talk-back response problem | ESP Wi-Fi | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Talk-back response problem
No permission to create posts
March 17, 2016
3:49 am
Avatar
parasbhanot
New Member
Members
Forum Posts: 1
Member Since:
March 17, 2016
sp_UserOfflineSmall Offline

hello everyone,
I am trying to get a TalkBack Command using Arduino IDE but i am not getting any response on Serial Monitor .. I have tested the following GET request with the Poster. it works perfectly.

https://api.thingspeak.com/talkbacks/7441/commands/1145081?api_key=WSMCMVFUJBI6Z115

[code]
#include

const char* ssid = "Wing";
const char* password = "wnRn56";

String apiKey = "WSMCMVFUJBI6Z115";

const char* host = "api.thingspeak.com";

// Use WiFiClient class to create TCP connections
WiFiClient client;

int t = 200;
int h = 400;

void setup() {
Serial.begin(115200);
delay(100);

// We start by connecting to a WiFi network

Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}

Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}

void loop() {

Serial.print("connecting to ");
Serial.println(host);

if (client.connect(host,80)) { // "184.106.153.149" or api.thingspeak.com

String postStr = "GET /talkbacks/7441/commands/1145000?api_key=WSMCMVFUJBI6Z115 HTTP/1.1
";

//client.print("POST /update HTTP/1.1
");

client.print(postStr);
client.print("Host: api.thingspeak.com
");
client.print("Connection: close
");
//client.print("X-THINGSPEAKAPIKEY: "+apiKey+"
");
//client.print("Content-Type: application/x-www-form-urlencoded
");
//client.print("Content-Length: ");
//client.print(postStr.length());
client.print("
");
}

client.stop();

// Read all the lines of the reply from server and print them to Serial
while(client.available()){

//String line = client.readStringUntil('
');
//Serial.print(line);

char c = client.read();
Serial.print(c);
}

Serial.println();
Serial.println("closing connection");
delay(15000);

}

[/code]

i think something is wrong with my GET request
What is the correct way to send Talkback GET request ?

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
26 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

aaceitunog01, AlinaCutle, MARTO, simplicity1, jango6954, LDN001

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457