I am trying to run a simple sketch through an Arduino Pro Mini connected to the WiFly using the WiFlySerial library. I am VERY new to this and I'm using some code I have pulled from other sketches. I have included my .ino file...
All I want to do is call a local server (192.168.1.23) and pull some data from the response.
This is the serial monitor of it when I upload and run it...
Starting Light Manager.
Free memory:915
Setting up WiFly
Starting WiFly...WiFlySerial v1.08 Free memory:901
MAC: 00:06:66:52:68:97
IP: 192.168.1.16:2000
Netmask: 255.255.255.0
Gateway: 192.168.1.1
DNS: 192.168.1.1
WiFly Sensors: 1
WiFly Temp: 1After Setup mem:901
Now RUNNING
Debug options:
Press '1' to send a test tweet
Press '2' to print current readings
Press '[' to access WiFly terminal to send commands to WiFly module
Beginning of Loop RAM:915
GET request:GET /api/newdeveloper/lights/3 HTTP/1.1
Host: 192.168.1.23
Connection: close
RAM: 657
Get request sent
Closing connection.
I was expecting to see the following response (which is what I get when I put 192.168.1.23/api/newdeveloper/lights/3 in a browser):
{"state": {"on":false,"bri":0,"hue":0,"sat":0,"xy":[0.0000,0.0000],"ct":0,"alert":"none","effect":"none","colormode":"hs","reachable":true}, "type": "Extended color light", "name": "Living room", "modelid": "LCT001", "swversion": "65003148", "pointsymbol": { "1":"none", "2":"none", "3":"none", "4":"none", "5":"none", "6":"none", "7":"none", "8":"none" }}
Can anyone explain why this code:
while ( TimeOut > millis() && WiFly.isConnectionOpen() )
{
if ( WiFly.available() > 0 ) {
Serial << (char) WiFly.read();
}
}
is not returning the response that I am showing above? It seems to be establishing a connection, but no response is being written to the serial monitor. Any help would be appreciated!
ManageLights.ino (10.5 KB)