hi, everyone. trying connect arduino uno r3 smd edition internet, via seeestudio ethernet shield v. 2.0 (w5200). came across similar post in forums, located here (http://forum.arduino.cc/index.php?topic=316764.0). solution not quite helpful me, seems. believe problem having simpler. think solution in post if understanding correctly changing definitions pins. believe has been updated in library since then.
what have tried running webserver example seeed ethernet libary:
the output serial monitor "server @ 192.168.0.2".
excellent, cannot connect server in web browser.
checking status of server nmap:
instead of connecting 192.168.0.2 tried appending :554 , :7070 it, still no avail. connection resets.
another tried simple "spi test" found in 1 of @surfertim's posts.
the output of promising well:
i feel close , doing stupid.
connection details: sharing wifi connection through laptop (running ubuntu). have used shared wifi laptop many devices. part of problem suppose.
any diagnosing problem appreciated! hoping hear more soon!
-kyle
what have tried running webserver example seeed ethernet libary:
code: [select]
/*
web server
a simple web server shows value of analog input pins.
using arduino wiznet ethernet shield.
circuit:
* ethernet shield attached pins 10, 11, 12, 13
* analog inputs attached pins a0 through a5 (optional)
created 18 dec 2009
by david a. mellis
modified 9 apr 2012
by tom igoe
*/
#include <spi.h>
#include <ethernetv2_0.h>
// enter mac address , ip address controller below.
// ip address dependent on local network:
byte mac[] = {
0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed };
ipaddress ip(192,168,0, 2);
// initialize ethernet server library
// ip address , port want use
// (port 80 default http):
ethernetserver server(80);
#define w5200_cs 10
#define sdcard_cs 4
void setup() {
// open serial communications , wait port open:
serial.begin(9600);
pinmode(sdcard_cs,output);
digitalwrite(sdcard_cs,high);//deselect sd card
// start ethernet connection , server:
ethernet.begin(mac, ip);
server.begin();
serial.print("server @ ");
serial.println(ethernet.localip());
}
void loop() {
// listen incoming clients
ethernetclient client = server.available();
if (client) {
serial.println("new client");
// http request ends blank line
boolean currentlineisblank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
serial.write(c);
// if you've gotten end of line (received newline
// character) , line blank, http request has ended,
// can send reply
if (c == '\n' && currentlineisblank) {
// send standard http response header
client.println("http/1.1 200 ok");
client.println("content-type: text/html");
client.println("connnection: close");
client.println();
client.println("<!doctype html>");
client.println("<html>");
// add meta refresh tag, browser pulls again every 5 seconds:
client.println("<meta http-equiv=\"refresh\" content=\"5\">");
// output value of each analog input pin
(int analogchannel = 0; analogchannel < 6; analogchannel++) {
int sensorreading = analogread(analogchannel);
client.print("analog input ");
client.print(analogchannel);
client.print(" ");
client.print(sensorreading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting new line
currentlineisblank = true;
}
else if (c != '\r') {
// you've gotten character on current line
currentlineisblank = false;
}
}
}
// give web browser time receive data
delay(1);
// close connection:
client.stop();
serial.println("client disonnected");
}
}
the output serial monitor "server @ 192.168.0.2".
excellent, cannot connect server in web browser.
checking status of server nmap:
code: [select]
nmap -pn 192.168.0.2
starting nmap 6.40 ( http://nmap.org ) @ 2015-10-06 18:19 edt
nmap scan report 192.168.0.2
host (0.021s latency).
not shown: 998 filtered ports
port state service
554/tcp open rtsp
7070/tcp open realserver
nmap done: 1 ip address (1 host up) scanned in 6.66 seconds
instead of connecting 192.168.0.2 tried appending :554 , :7070 it, still no avail. connection resets.
another tried simple "spi test" found in 1 of @surfertim's posts.
code: [select]
#include <spi.h>
#include <ethernetv2_0.h>
byte mac[] = { 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed };
ipaddress ip(192,168,0,2);
void setup() {
serial.begin(9600);
// disable sd card if 1 in slot
pinmode(4,output);
digitalwrite(4,high);
serial.println("starting w5200");
ethernet.begin(mac,ip);
serial.println(ethernet.localip());
}
void loop() {
}
the output of promising well:
code: [select]
starting w5200
192.168.0.2
i feel close , doing stupid.
connection details: sharing wifi connection through laptop (running ubuntu). have used shared wifi laptop many devices. part of problem suppose.
any diagnosing problem appreciated! hoping hear more soon!
-kyle
hi again, everyone. have solved problem. , expected "stupid" (not really). turns out because using "shared internet" connection router, needed using different ip address. makes perfect sense in retrospect, arduino not seeing lan. in it's own network, safe , sound.
so line of code needed changed:
when @ 10.42.0.25 in browser, responding pin readings should be, webserver example.
my problem simple matter of finding correct ip address.
so line of code needed changed:
code: [select]
ipaddress ip(192,168,1,177);
code: [select]
ipaddress ip(10,42,0,25);
when @ 10.42.0.25 in browser, responding pin readings should be, webserver example.
my problem simple matter of finding correct ip address.
Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > [solved] trouble setting up an arduino uno + seed ethernet shield as a webserver
arduino
Comments
Post a Comment