Hai,
My project is to update data to thinkspeak using arduino uno and wizfi210 (DFRobot wifi shield v2.2), and i found similar topic here
I try the step using Arduino IDE serial monitor, and below the result
ATI2
WizFi210
1.1.1.0(W)
[OK]
AT+WA=INSTIL_RESEARCH_LAB
IP SubNet Gateway
10.8.132.250: 255.255.254.0: 10.8.132.254
[OK]
AT+SETTIME=31/07/2013,10:21:11
[OK]
AT+NCTCP=184.106.153.149,80 ///THINKSPEAK ip AND PORT
[OK]
{1B}S0GET / HTTP/1.1{0x0d}{0xa}{0x0d}{0xa}{1B}E
[ERROR: INVALID INPUT]
My question is:
1.How to use ESC sequence in arduino IDE as i already try “{1B}”,“(1B)”,“{27}”,“(27)”, still fail
2.How to post data to server (like thinkspeak)?
Below my code in arduino
You have to modify {xx} command to HEXA code.
For example {1B} command means a hexa code of the ESC key function.
{0x0d}{0x0a} means carriage return and line feeds as known as ENTER key function.(\r\n)
So you can get the response from cloud server after typing ESC, carriage return, line feeds instead of {xx}.
Thingspeak.com needs the string of information(POST ~~, api_key ~~, message ~~)
AND it have to be just sent as below rules.
client.print(“POST /update HTTP/1.1\n”);
client.print(“Host: api.thingspeak.com\n”);
client.print(“Connection: close\n”);
client.print(“X-THINGSPEAKAPIKEY: “+writeAPIKey+”\n”);
client.print(“Content-Type: application/x-www-form-urlencoded\n”);
client.print(“Content-Length: “);
client.print(tsData.length());
client.print(”\n\n”);
I already manage to update the data to thinkspeak.
What I do is use serial.write in arduino to send hexa code to serial.Below is my test code
Serial.print("AT+NCTCP=184.106.153.149,80\n\r"); //Attempt TCP client connection to Destination
delay(1000);
if(Serial.find("OK")) // if success, connect to network
{
Serial.println("TCP connection success");
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
Serial.write(0x1b);
Serial.print("S0");
Serial.print("GET /update?key=F2J4TD75PYVIWMQ1&field1=");
Serial.print(data);
Serial.print("HTTP/1.1\r\n");
Serial.print("Host: api.thingspeak.com\r\n\r\n");
Serial.write(0x1b);
Serial.print("E");
delay(1000);
}