Offline
Full Member
Karma: 0
Posts: 208
|
 |
« Reply #15 on: May 11, 2012, 03:27:18 pm » |
irgendwie klappt es leider immer noch nicht...kann ich irgendwie testen ob die seite aufgerufen wurde?mein webhoster bietet leider keine webstatistik an
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 8
Posts: 633
42
|
 |
« Reply #16 on: May 11, 2012, 03:29:33 pm » |
warte kurz, ich bastel kurz was...
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 208
|
 |
« Reply #17 on: May 11, 2012, 03:33:32 pm » |
wahnsinn, ich glaube du bist ein echter Freak, das ist komplett positiv gemeint und ich bin dir zu tiefst dankbar.
|
|
|
|
« Last Edit: May 11, 2012, 03:42:15 pm by Ballibum »
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 8
Posts: 633
42
|
 |
« Reply #18 on: May 11, 2012, 03:53:16 pm » |
schmeiß mal statt deiner Seite folgende Seite in den Sketch rein: " http://mwsystec.de/redfly.php" Unter " http://mwsystec.de/redfly_reader.php" kannst du dann kucken, obs geklappt hat... EDIT: hier der Code, der jeweiligen PHP-Seiten redfly.php <?PHP echo "<h1>Redfly Tester</h1>";
$handle = fopen("redfly.txt", "a"); fwrite ($handle, "request from: ".$_SERVER['REMOTE_ADDR']. " at ". date("d.m.Y H:i:s",time())."\r\n"); fwrite ($handle, "REQUEST:\r\n"); fwrite ($handle, print_r($_REQUEST,true)); fwrite ($handle, "\r\n"); fwrite ($handle, "POST: \r\n".print_r($_POST,true)); fwrite ($handle, "\r\n"); fwrite ($handle, "GET: \r\n".print_r($_GET,true)); fwrite ($handle, "\r\n"); fwrite ($handle, "\r\n");
fclose ($handle); ?>
redfly_reader.php <?PHP
echo "<h1>Redfly Test Reader</h1>";
$handle = @fopen("redfly.txt", "r"); $file = ""; if ($handle) { while (($buffer = fgets($handle, 4096)) !== false) { $file .= $buffer; } }
echo "<pre>"; echo $file; echo "</pre>"; ?>
PS: Den Freak seh ich durchaus als Kompliment an  EDIT: redfly.php um Requestlog ergänzt
|
|
|
|
« Last Edit: May 11, 2012, 04:18:58 pm by Marcus W »
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 208
|
 |
« Reply #19 on: May 11, 2012, 04:05:33 pm » |
Ich habe jetzt folgendes gemacht: Sprich ich habe auf deine Seite verlinkt und dazu lediglich die IP der Seite geändert (im Sketch natürlich) /* Web Client This sketch connects to a website using a RedFly-Shield. */
#include <RedFly.h>
byte ip[] = { 192,168, 1,138 }; //ip from shield (client) byte netmask[] = { 255,255,255, 0 }; //netmask byte gateway[] = { 192,168, 1, 1 }; //ip from gateway/router byte dnsserver[] = { 192,168, 1, 1 }; //ip from dns server byte server[] = { 188, 40,236, 77 }; //ip from www.watterott.net (server) #define HOSTNAME "http://www.mwsystec.de" //host
uint8_t http=0xFF; //socket handle uint16_t http_len=0; //receive len char http_buf[512]; //receive buffer
//serial format: 9600 Baud, 8N2 void debugout(char *s) { RedFly.disable(); Serial.print(s); RedFly.enable(); } void debugoutln(char *s){ RedFly.disable(); Serial.println(s); RedFly.enable(); }
void setup() { uint8_t ret; //init the WiFi module on the shield ret = RedFly.init(); if(ret) { debugoutln("INIT ERR"); //there are problems with the communication between the Arduino and the RedFly } else { //scan for wireless networks (must be run before join command) RedFly.scan();
//join network ret = RedFly.join("meineSSID", "meinPasswort", INFRASTRUCTURE); if(ret) { debugoutln("JOIN ERR"); for(;;); //do nothing forevermore } else { //set ip config //ret = RedFly.begin(); //DHCP ret = RedFly.begin( 2); //1=DHCP or 2=Auto-IP // ret = RedFly.begin(ip); ret = RedFly.begin(ip, dnsserver, gateway, netmask); if(ret) { debugoutln("BEGIN ERR"); RedFly.disconnect(); for(;;); //do nothing forevermore } else { if(RedFly.getip(HOSTNAME, server) == 0) //get ip { http = RedFly.socketConnect(PROTO_TCP, server, 80); //start connection to server on port 80 if(http == 0xFF) { debugoutln("SOCKET ERR"); RedFly.disconnect(); for(;;); //do nothing forevermore } else { //send HTTP request RedFly.socketSendPGM(http, PSTR("POST / HTTP/1.1\r\nHost: "HOSTNAME"/redfly.php\r\n\r\n")); } } else { debugoutln("DNS ERR"); RedFly.disconnect(); for(;;); //do nothing forevermore } } } } }
void loop() { uint8_t sock, buf[32]; uint16_t rd, len; //Serial.println("Ausgabe"); if(http == 0xFF) //no socket open { return; }
sock = 0xFF; //0xFF = return data from all open sockets rd = RedFly.socketRead(&sock, &len, buf, sizeof(buf)); if(sock == http) { if((rd != 0) && (rd != 0xFFFF)) { if((http_len+rd) > sizeof(http_buf)) { rd = sizeof(http_buf)-http_len; } memcpy(&http_buf[http_len], buf, rd); http_len += rd; }
if((rd == 0xFFFF) || (len == 0)) //connection closed or all data received { //close connection RedFly.socketClose(sock);
//show http buffer http_buf[sizeof(http_buf)-1] = 0; debugout(http_buf); } } }
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 8
Posts: 633
42
|
 |
« Reply #20 on: May 11, 2012, 04:10:00 pm » |
OK - jetzt wissen wir schon mehr - laut Log konte sich dein Arduino verbinden. was er jetzt genau als Post gesendet hat, wissen wir allerdings noch nicht... aber auch das kann man herausfinden.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 208
|
 |
« Reply #21 on: May 11, 2012, 04:13:42 pm » |
Nein, ich glaube das war vorallem mein Rechner*G* ICh bekomme folgenden Fehler bei deinem Link: Un AT+RSI_FWVERSION? AT+RSI_BAND=0 AT+RSI_INIT AT+RSI_NUMSCAN=0 AT+RSI_SCAN=0 AT+RSI_NETWORK=INFRASTRUCTURE AT+RSI_PSK=1********* AT+RSI_JOIN=*********,0,2 AT+RSI_DNSSERVER=192.168.1.1 AT+RSI_IPCONF=0,192.168.1.48Q38,255.255.255.0,192.168.1.1 AT+RSI_DNSGET=http://mwsystec.de AT+RSI_DNSGET=http://mwsystec.de AT+RSI_DNSGET=http://mwsystec.de DNS ERR AT+RSI_DISASSOC
Also muss irgendwie schon wieder ein DNS fehler auftauchen
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 8
Posts: 633
42
|
 |
« Reply #22 on: May 11, 2012, 04:14:39 pm » |
probier jetzt nochmal den Logger - ich hab ihn umgebastelt, so dass er den Request mitloggt. EDIT - da warst du schneller als ich... also sieht aus, als ob er den Namen nicht auflösen kann - warum auch immer... wichtig wäre jetzt zu wissen, ob es über ip gehen würde, sprich ob es wirklich "nur" am DNS liegt... du kannst Spasshalber mal statt des Hostnames die IP meines Servers eingeben, müsste auch funktionieren: http://188.40.236.77/redfly.php ... hab ihn so eingestellt, dass er ip-requests annimmt. EDIT 2: Poste mal bitte deinen KOMPLETTEN Sketch - naürlich mit geschwärzten Zugangsdaten für dein WLAN
|
|
|
|
« Last Edit: May 11, 2012, 04:26:14 pm by Marcus W »
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 208
|
 |
« Reply #23 on: May 11, 2012, 04:17:58 pm » |
Ich bekomme leider immer diesen DNS Error
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 8
Posts: 633
42
|
 |
« Reply #24 on: May 11, 2012, 04:26:35 pm » |
Poste mal bitte deinen KOMPLETTEN Sketch - natürlich mit geschwärzten Zugangsdaten für dein WLAN
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 208
|
 |
« Reply #25 on: May 11, 2012, 04:28:15 pm » |
Also jetzt initialisiert er nicht einmal mehr das WLAN Shield, warum auch immer.....Mal sehen woran das liegt.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 208
|
 |
« Reply #26 on: May 11, 2012, 04:35:37 pm » |
Ich glaube nur langsam nicht mehr dran, weil er das Shield wie gesagt nicht mehr initialisiert.....eventuell hat sich die firmware verabschiedet /* Web Client This sketch connects to a website using a RedFly-Shield. */
#include <RedFly.h>
byte ip[] = { 192,168, 1,138 }; //ip from shield (client) byte netmask[] = { 255,255,255, 0 }; //netmask byte gateway[] = { 192,168, 1, 1 }; //ip from gateway/router byte dnsserver[] = { 192,168, 1, 1 }; //ip from dns server byte server[] = { 188, 40,236, 77 }; //85.25.245.16 #define HOSTNAME "http://mwsystec.de" //host www.hemitheconyx-caudicinctus.de
uint8_t http=0xFF; //socket handle uint16_t http_len=0; //receive len char http_buf[512]; //receive buffer
//serial format: 9600 Baud, 8N2 void debugout(char *s) { RedFly.disable(); Serial.print(s); RedFly.enable(); } void debugoutln(char *s){ RedFly.disable(); Serial.println(s); RedFly.enable(); }
void setup() { uint8_t ret; //init the WiFi module on the shield ret = RedFly.init(); if(ret) { debugoutln("INIT ERR"); //there are problems with the communication between the Arduino and the RedFly } else { //scan for wireless networks (must be run before join command) RedFly.scan();
//join network ret = RedFly.join("******", "1*****", INFRASTRUCTURE); if(ret) { debugoutln("JOIN ERR"); for(;;); //do nothing forevermore } else { //set ip config // ret = RedFly.begin(); //DHCP // ret = RedFly.begin( 2 ); //1=DHCP or 2=Auto-IP // ret = RedFly.begin(ip); ret = RedFly.begin(ip, dnsserver, gateway, netmask); if(ret) { debugoutln("BEGIN ERR"); RedFly.disconnect(); for(;;); //do nothing forevermore } else { if(RedFly.getip(HOSTNAME, server) == 0) //get ip { http = RedFly.socketConnect(PROTO_TCP, server, 80); //start connection to server on port 80 if(http == 0xFF) { debugoutln("SOCKET ERR"); RedFly.disconnect(); for(;;); //do nothing forevermore } else { //send HTTP request RedFly.socketSendPGM(http, PSTR("POST / HTTP/1.1\r\nHost: "HOSTNAME"/redfly.php\r\n\r\n")); } } else { debugoutln("DNS ERR"); RedFly.disconnect(); for(;;); //do nothing forevermore } } } } }
void loop() { uint8_t sock, buf[32]; uint16_t rd, len; //Serial.println("Ausgabe"); if(http == 0xFF) //no socket open { return; }
sock = 0xFF; //0xFF = return data from all open sockets rd = RedFly.socketRead(&sock, &len, buf, sizeof(buf)); if(sock == http) { if((rd != 0) && (rd != 0xFFFF)) { if((http_len+rd) > sizeof(http_buf)) { rd = sizeof(http_buf)-http_len; } memcpy(&http_buf[http_len], buf, rd); http_len += rd; }
if((rd == 0xFFFF) || (len == 0)) //connection closed or all data received { //close connection RedFly.socketClose(sock);
//show http buffer http_buf[sizeof(http_buf)-1] = 0; debugout(http_buf); } } }
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 8
Posts: 633
42
|
 |
« Reply #27 on: May 11, 2012, 04:40:07 pm » |
das wäre bitter - aber lass uns das Ding erstmal auf ein minimum stutzen und ein bisschen strukturieren - am liebsten durch den exzesiven Einsatz von Methoden  Ich bastel mal wieder - allerdings hier im blindflug, da ich kein derartiges Shield habe, und poste es dann... dauert allerdings nen Moment
|
|
|
|
« Last Edit: May 11, 2012, 04:42:18 pm by Marcus W »
|
Logged
|
|
|
|
|
Offline
Full Member
Karma: 0
Posts: 208
|
 |
« Reply #28 on: May 11, 2012, 04:42:19 pm » |
Ich danke dir dafür, aber ich werde erstmal schauen wie ich das Firmware Update drauf gespielt bekomme....
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 8
Posts: 633
42
|
 |
« Reply #29 on: May 11, 2012, 04:47:16 pm » |
Kein Ding, ich wühl mich solange durch den Sketch
|
|
|
|
|
Logged
|
|
|
|
|
|