Ether.BrowseUrl Arduino

Fermé
Etudiant - 16 janv. 2016 à 18:17
Bonjour,

Je débute avec le shield ethernet vellemen avec un ENC28J60

je souhaite envoyer des données sur un serveur web local (sous wamp) avec son ip via ether.BrowseUrl

Fonctionne sans soucis via un nom de domain et dns mais en remplacent char website[] PROGMEM = "www.google.fr"; par char website[] PROGMEM = "192.168.1.5"; avec l'adresse du seveur (192.168.1.5) je n'ai plus aucun retour aux requêtes, si quelqu'un veut bien m'aider

Le code utilisé avec :


// This demo does web requests via DHCP and DNS lookup.
// 2011-07-05 <***@***> http://opensource.org/licenses/mit-license.php

#include <EtherCard.h>

#define REQUEST_RATE 5000 // milliseconds

// ethernet interface mac address
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
// remote website name
char website[] PROGMEM = "www.google.fr";

byte Ethernet::buffer[700];
static long timer;

// called when the client request is complete
static void my_result_cb (byte status, word off, word len) {
Serial.print("<<< reply ");
Serial.print(millis() - timer);
Serial.println(" ms");
Serial.println((const char*) Ethernet::buffer + off);
}

void setup () {
Serial.begin(57600);
Serial.println("\n[getDHCPandDNS]");

if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println( "Failed to access Ethernet controller");

if (!ether.dhcpSetup())
Serial.println("DHCP failed");

ether.printIp("My IP: ", ether.myip);
// ether.printIp("Netmask: ", ether.mymask);
ether.printIp("GW IP: ", ether.gwip);
ether.printIp("DNS IP: ", ether.dnsip);

if (!ether.dnsLookup(website))
Serial.println("DNS failed");
ether.printIp("Server: ", ether.hisip);

timer = - REQUEST_RATE; // start timing out right away
}

void loop () {
// DHCP expiration is a bit brutal, because all other ethernet activity and
// incoming packets will be ignored until a new lease has been acquired
if (ether.dhcpExpired() && !ether.dhcpSetup())
Serial.println("DHCP failed");

ether.packetLoop(ether.packetReceive());

if (millis() > timer + REQUEST_RATE) {
timer = millis();
Serial.println("\n>>> REQ");
ether.browseUrl(PSTR("/foo/"), "bar", website, my_result_cb);
}
}