-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enc28j60 with arduino and local web service - arduino #394
Comments
I took a quick look at your code and didn't find anything wrong with it, except that you can remove the code between the
Good luck! |
Hi nuno-silva ether.browseUrl(PSTR("/search?"), PSTR("source=hp&ei=I2MqX6zHLdf8rQGo7LPIAg&q=test&oq=test&gs_lcp=CgZwc3ktYWIQAzIFCAAQsQMyBQgAELEDMgIIADIFCAAQsQMyCAgAELEDEIMBMgUIABCxAzIICAAQsQMQgwEyBQgAELEDMgUIABCxAzICCAA6BQguELEDOgsILhCxAxDHARCjAjoCCC5Q2hRYshpg3x5oAHAAeACAAXaIAYADkgEDMy4xmAEAoAEBqgEHZ3dzLXdpeg&sclient=psy-ab&ved=0ahUKEwjs5IC6yIPrAhVXfisKHSj2DCkQ4dUDCAY&uact=5"), website, my_callback); chnaging codes like and even tried I can see the same old Serial Output <<< REQ If anyone is able to help me, that would be great. |
If you weren't able to get a response using google's IP directly, either there's an issue with |
Hi,
#include <EtherCard.h> #define REQUEST_RATE 5000 // milliseconds // ethernet interface mac address byte Ethernet::buffer[300]; // a very small tcp/ip buffer is enough here // called when the client request is complete void setup () { // Change 'SS' to your Slave Select pin, if you arn't using the default pin ether.staticSetup(myip, gwip, NULL, mask); while (ether.clientWaitingGw()) timer = - REQUEST_RATE; // start timing out right away void loop () { if (millis() > timer + REQUEST_RATE) { Output:
Server: 3.225.178.102
default backend - 404 but i am trying with local ip there is no response.
// ethernet interface ip address
|
If you can get a response from google's IP but not from your server's IP, possible causes are:
Also note that as far as I know ethercard does not support TLS/SSL/HTTPS (port 443). |
I am trying to use Arduino Uno with ENC28j60 to send data to my local web server
the URL i used is ( http://192.168.10.6:8338/heartbeat?table=1)
when i use this URL in browser it return "OK".
with Arduino
i use this code but i can't get a result
#include <EtherCard.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[700];
static uint32_t timer;
const char website[] PROGMEM = "192.168.10.6";
// called when the client request is complete
static void my_callback (byte status, word off, word len) {
Serial.println(">>>");
Ethernet::buffer[off+300] = 0;
Serial.print((const char*) Ethernet::buffer + off);
Serial.println("...");
}
void setup () {
Serial.begin(57600);
Serial.println(F("\n[webClient]"));
// Change 'SS' to your Slave Select pin, if you arn't using the default pin
if (ether.begin(sizeof Ethernet::buffer, mymac, SS) == 0)
Serial.println(F("Failed to access Ethernet controller"));
if (!ether.dhcpSetup())
Serial.println(F("DHCP failed"));
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
#if 1
// use DNS to resolve the website's IP address
//if (!ether.dnsLookup(website))
// Serial.println("DNS failed");
char websiteIP[] = "192.168.10.6";
ether.parseIp(ether.hisip, websiteIP);
#elif 2
// if website is a string containing an IP address instead of a domain name,
// then use it directly. Note: the string can not be in PROGMEM.
char websiteIP[] = "192.168.10.6";
ether.parseIp(ether.hisip, websiteIP);
#else
// or provide a numeric IP address instead of a string
byte hisip[] = { 192,168,10,6 };
ether.copyIp(ether.hisip, hisip);
#endif
ether.printIp("SRV: ", ether.hisip);
}
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) {
timer = millis() + 5000;
Serial.println();
Serial.print("<<< REQ ");
ether.hisport = 8338;//to access local host
ether.browseUrl(PSTR("/heartbeat?"), "table=3", website, my_callback);
// ether.browseUrl(PSTR("/heartbeat?table=3"), "", website, my_callback);
}
}
Serial Output :
[webClient]
IP: 192.168.10.5
GW: 192.168.10.1
DNS: 203.145.184.32
SRV: 192.168.10.6
<<< REQ
<<< REQ
<<< REQ
<<< REQ
<<< REQ
<<< REQ
<<< REQ
<<< REQ
how to send " HTTP GET with request headers " Using Ethercard library(Web Client), to Local-IP Address. Thanks a lot in advance for any help/info.
The text was updated successfully, but these errors were encountered: