J'ai mis un méga arduino et le bouclier GSM Arduino avec un FYVE (vodafone) - Sim ensemble. Long terme Je veux ajouter un GPS pour envoyer des données de position via le module GSM à data.sparkfun.com. Pour démarrer mon code, j'ai commencé avec l'exemple GsmWebClient d'arduino. Le problème est, que je reçois constamment le "HTTP/1.1 302 Trouvé - Erreur". Donc, apparemment, je suis redirigé. J'ai l'impression qu'il doit y avoir une solution assez facile, mais je n'arrive pas à la comprendre. Fondamentalement lu à travers l'Internet entier. Je ne sais vraiment pas ce qui se passe et je me sens plutôt stupide maintenant.Arduino GSM Shield WebClient 302
Si je change l'APN à web.vodafone.de GSM et GPRS se connecter, mais ne marche pas client.
vient ici le code et la réponse de la série:
// libraries
#include <GSM.h>
// PIN Number
#define PINNUMBER "****"
// APN data
#define GPRS_APN "event.vodafone.de" // replace your GPRS APN
#define GPRS_LOGIN "" // replace with your GPRS login
#define GPRS_PASSWORD "" // replace with your GPRS password
// initialize the library instance
GSMClient client;
GPRS gprs;
GSM gsmAccess;
// URL, path & port (for example: arduino.cc)
char server[] = "arduino.cc";
char path[] = "/asciilogo.txt";
int port = 80; // port 80 is the default for HTTP
void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Starting Arduino web client.");
// connection state
boolean notConnected = true;
// After starting the modem with GSM.begin()
// attach the shield to the GPRS network with the APN, login and password
while (notConnected) {
Serial.println("connecting gsm");
if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
Serial.println("gsm connected");
delay(1000);
Serial.println("connecting gprs");
if (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == GPRS_READY) {
Serial.println("gprs connected");
notConnected = false;
}
else {
Serial.println("gprs Not connected");
delay(1000);
}
}
else {
Serial.println("gsm Not connected");
delay(1000);
}
}
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect(server, port)) {
Serial.println("connected");
// Make a HTTP request:
client.println("GET /asciilogo.txt HTTP/1.1");
client.print("Host: ");
client.println("www.arduino.cc");
client.println("Connection: close");
client.println();
}
}
void loop() {
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c = client.read();
Serial.print(c);
}
// if the server's disconnected, stop the client:
if (!client.available() && !client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing forevermore:
for (;;)
;
}
}
Démarrage client Web Arduino.
connexion GSM
GSM connecté
gprs connexion
gprs connecté
connexion ...
connecté
HTTP/1.1 302 Found
Date: Thu, 23 février 2017 18:13:45 GMT
serveur: Apache
Connection: close
Content-Length: 0
Variez: User-Agent
Cache-Control: no-transform
Type de contenu: texte/brut; charset = ISO-8859-1
déconnexion.
Eh bien, là vous l'avez. J'espère que quelqu'un peut m'aider ici, ce truc me rend fou.
Cordialement Arne