read the value from parse string | ESP8266 Wi-Fi Module | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





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

Register Lost password?
sp_Feed sp_TopicIcon
read the value from parse string
Avatar
hanguyen
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
1
April 21, 2015 - 1:38 pm
sp_Permalink sp_Print

can you help me the code to get value from
https://api.thingspeak.com/apps/thinghttp/send_request?api_key=0AGGWTN8KU5C5QN8
I get the code which can connect Wifi through esp8266, but I dont know how to get the value
can you help me
below is the code that i can run with esp8266 & uno
#include

#include

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
#include
#include

#define SSID ""
#define PASS ""
#define IP "184.106.153.149" // thingspeak.com
String GET = "GET /update?key=IJO0IVY7KD6PAA5E&field1=";
SoftwareSerial monitor(0, 1); // RX, TX

void setup()
{
monitor.begin(9600);
Serial.begin(9600);
lcd.begin(16,2); // columns, rows. size of display
lcd.clear();
sendDebug("AT");
delay(1000);
if(Serial.find("OK")){
monitor.println("RECEIVED: OK");
connectWiFi();
}
}

void loop(){

updateTemp( 4);
delay(1000);
}

void updateTemp( ){
String cmd = "AT+CIPSTART=\"TCP\",\"";
cmd += IP;
cmd += "\",80";
sendDebug(cmd);
delay(1000);
if(Serial.find("Error")){
monitor.print("RECEIVED: Error");
return;
}
cmd = GET +"
";
Serial.print("AT+CIPSEND=");
Serial.println(cmd.length());

if(Serial.find(">")){
monitor.print(">");
monitor.print(cmd);
Serial.print(cmd);
lcd.setCursor(0,0);
lcd.print("C");
}else{
sendDebug("AT+CIPCLOSE");
lcd.setCursor(0,0);
lcd.print("N");
}
if(Serial.find("OK")){
monitor.println("RECEIVED: OK");
}else{
monitor.println("RECEIVED: Error");
}
}
void sendDebug(String cmd){
monitor.print("SEND: ");
monitor.println(cmd);
Serial.println(cmd);
}

boolean connectWiFi(){
Serial.println("AT+CWMODE=1");
delay(1000);
String cmd="AT+CWJAP=\"";
cmd+=SSID;
cmd+="\",\"";
cmd+=PASS;
cmd+="\"";
sendDebug(cmd);
delay(1000);
if(Serial.find("OK")){
monitor.println("RECEIVED: OK");
return true;
}else{
monitor.println("RECEIVED: Error");
return false;
}
}

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
38 Guest(s)

Currently Browsing this Page:
2 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

ibgedubo

aogomaeqaza

ureomug

itixuwidouzuv

eilimir

memozupi

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee