WiFly Httpget
i bought bad wifi shield seedstudio, shield rn-171 model named wls06201p
i wanted try send multiple http parameters fails. need help. maybe knows how bad shield work
when run code below, opening serial monitor , see "failed parse url" , "path buffer small"
#include <arduino.h>
#include <softwareserial.h>
#include <wifly.h>
#include "httpclient.h"
#define ssid "your-ssid"
#define key "passphrase"
// wifly_auth_open / wifly_auth_wpa1 / wifly_auth_wpa1_2 / wifly_auth_wpa2_psk
#define auth wifly_auth_wpa2_psk
#define http_get_url "http://myserver.com/workingservice.aspx?sectiona=12345§ionb=98765"
// pins' connection
// arduino wifly
// 2 <----> tx
// 3 <----> rx
wifly wifly(2, 3);
httpclient http;
char get;
void setup() {
serial.begin(9600);
serial.println("------- wifly http --------");
// wait wifly init
// delay(3000);
wifly.reset();
while (1) {
serial.println("try join " ssid );
if (wifly.join(ssid, key, auth)) {
serial.println("succeed join " ssid);
wifly.clear();
break;
} else {
serial.println("failed join " ssid);
serial.println("wait 1 second , try again...");
delay(1000);
}
}
serial.println("\r\ntry url - " http_get_url);
serial.println("------------------------------");
while (http.get(http_get_url, 10000) < 0) {
}
while (wifly.receive((uint8_t *)&get, 1, 1000) == 1) {
serial.print(get);
}
}
void loop() {
int c;
while (wifly.available()) {
c = wifly.read();
if (c > 0) {
serial.write((char)c);
}
}
while (serial.available()) {
c = serial.read();
if (c >= 0) {
wifly.write((char)c);
}
}
}
i wanted try send multiple http parameters fails. need help. maybe knows how bad shield work
when run code below, opening serial monitor , see "failed parse url" , "path buffer small"
#include <arduino.h>
#include <softwareserial.h>
#include <wifly.h>
#include "httpclient.h"
#define ssid "your-ssid"
#define key "passphrase"
// wifly_auth_open / wifly_auth_wpa1 / wifly_auth_wpa1_2 / wifly_auth_wpa2_psk
#define auth wifly_auth_wpa2_psk
#define http_get_url "http://myserver.com/workingservice.aspx?sectiona=12345§ionb=98765"
// pins' connection
// arduino wifly
// 2 <----> tx
// 3 <----> rx
wifly wifly(2, 3);
httpclient http;
char get;
void setup() {
serial.begin(9600);
serial.println("------- wifly http --------");
// wait wifly init
// delay(3000);
wifly.reset();
while (1) {
serial.println("try join " ssid );
if (wifly.join(ssid, key, auth)) {
serial.println("succeed join " ssid);
wifly.clear();
break;
} else {
serial.println("failed join " ssid);
serial.println("wait 1 second , try again...");
delay(1000);
}
}
serial.println("\r\ntry url - " http_get_url);
serial.println("------------------------------");
while (http.get(http_get_url, 10000) < 0) {
}
while (wifly.receive((uint8_t *)&get, 1, 1000) == 1) {
serial.print(get);
}
}
void loop() {
int c;
while (wifly.available()) {
c = wifly.read();
if (c > 0) {
serial.write((char)c);
}
}
while (serial.available()) {
c = serial.read();
if (c >= 0) {
wifly.write((char)c);
}
}
}
if change
#define http_get_url "http://myserver.com/workingservice.aspx?sectiona=12345§ionb=98765"
to
#define http_get_url "http://myserver.com/workingservice.aspx?sectiona=1234§ionb=98"
the code working. hell dont know
is there fix problem ?
#define http_get_url "http://myserver.com/workingservice.aspx?sectiona=12345§ionb=98765"
to
#define http_get_url "http://myserver.com/workingservice.aspx?sectiona=1234§ionb=98"
the code working. hell dont know

is there fix problem ?
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > WiFly Httpget
arduino
Comments
Post a Comment