Wifly thingspeak
<cpp> $$$ set wlan ssid MySSID # configure your wifi access point name set wlan pass MyPASSWORD # configure your wifi password set ip tcp-mode 0x0 # default TCP-Mode flags set ip flags 0x6 # default TCP/IP setup flags set ip protocol 2 # TCP server and client (only) set sys autoconn 1 # auto-connect to remote host on powerup set ip host 184.106.153.149 # IP address of ThingSpeak server set ip remote 80 # IP port number of remote TCP host set comm remote POST # string sent to remote TCP host when port opens save # store config setup in flash reboot # restart and auto-join wifi, auto-open TCP to host
Now you can manually enter the data to ThingSpeak through the WiFly serial terminal but every line must end with 2-character pair CR LF which may not happen just with the 'enter' key, I had to type control-M control-J after each line. Note initial 'POST' missing as I configured that to be the string sent immediately upon opening the TCP connection to port 80, above. So first character typed is a space, then /update etc. CR = ^M = 0x0d = \r = Carriage return LF = ^J = 0x0a = \n = Line feed
/update HTTP/1.1 Host: api.thingspeak.com Connection: close X-THINGSPEAKAPIKEY: MySecretKey Content-Type: application/x-www-form-urlencoded Content-Length: 29
field1=354&status=Just_a_test </cpp>
#include "WiFly.h" #include "Credentials.h"
WiFly to Router to R-Pi R-Pi to ThingSpeak, using Python translator
Arduino #include "WiFly.h" #include "Credentials.h"