<div dir="ltr"><div>Have you tried adding debug print messages on the Arduino to see what it is doing?<br><br></div>For example, adding one at the start and end of setup(), then at the start of loop(), then just inside the "if (client)", and then within the "while (client.connected)" - this will let you know where in the code you are getting hung up.<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 1, 2014 at 11:01 PM, Jon Wolfe <span dir="ltr"><<a href="mailto:jonjwolfe@anibit.com" target="_blank">jonjwolfe@anibit.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>9 volt batteries are notiously flaky. Not saying it's definitely the culprit, but I've lost sleep over them in the past. They're good at looking fine under no or light load.<div><br></div><div>Also, what subnet mask is in use in your code? How are you trying to connect to the arduino over the lan? Does it work as a client (might be easier to make sure that works first). </div><div><br></div><div>Those are just some ideas off the top of my head...</div><div><br></div><div>You could also try the app. "fing" on a pc or tablet. It scans local ip networks. There used to be some arp tools back in the day on unix that could find stuff by mac address,  I think even if tcp/ip was not functional. </div><div><div class="h5"><div><br></div><br><br><div>-------- Original message --------</div><div>From: Dwight Morgan <u></u> </div><div>Date:12/01/2014  10:47 PM  (GMT-05:00) </div><div>To: <a href="mailto:triembed@triembed.org" target="_blank">triembed@triembed.org</a> </div><div>Subject: [TriEmbed] Arduino Topic for Dec 7 Meeting? </div><div><br></div><div><p class="MsoNormal">I’m a newbie and going through the Simon Monk book, “Programming Arduino Getting Started with Sketches”. I am stuck on chapter 10, “Arduino Ethernet Programming”. I have tried numerous things to get the Arduino to act as a server but it just won’t connect. I’m running Windows 7 on my PC and I have a Netgear router for my wireless router with 4 wired ports. I’ve plugged the RJ45 into the router and my PC and tried different IP addresses that are not taken by my router already but nothing works. I cut off the firewall once but that didn’t help. I replaced the Ethernet shield and the UNO but that didn’t help. I’m trying to run the simplest code as best I can tell which is the Monk example code 10-01 copied below for reference:<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">// sketch 10-01 Simple Server Example<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">#include <SPI.h><u></u><u></u></p><p class="MsoNormal">#include <Ethernet.h><u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">// MAC address just has to be unique. This should work<u></u><u></u></p><p class="MsoNormal">byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };<u></u><u></u></p><p class="MsoNormal">// The IP address will be dependent on your local network:<u></u><u></u></p><p class="MsoNormal">byte ip[] = { 192, 168, 1, 30 };<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">EthernetServer server(80);<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">void setup()<u></u><u></u></p><p class="MsoNormal">{<u></u><u></u></p><p class="MsoNormal">  Ethernet.begin(mac, ip);<u></u><u></u></p><p class="MsoNormal">  server.begin();<u></u><u></u></p><p class="MsoNormal">  Serial.begin(9600);<u></u><u></u></p><p class="MsoNormal">}<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">void loop()<u></u><u></u></p><p class="MsoNormal">{<u></u><u></u></p><p class="MsoNormal">  // listen for incoming clients<u></u><u></u></p><p class="MsoNormal">  EthernetClient client = server.available();<u></u><u></u></p><p class="MsoNormal">  if (client) <u></u><u></u></p><p class="MsoNormal">  {<u></u><u></u></p><p class="MsoNormal">    while (client.connected()) <u></u><u></u></p><p class="MsoNormal">    {<u></u><u></u></p><p class="MsoNormal">      // send a standard http response header<u></u><u></u></p><p class="MsoNormal">      client.println("HTTP/1.1 200 OK");<u></u><u></u></p><p class="MsoNormal">      client.println("Content-Type: text/html");<u></u><u></u></p><p class="MsoNormal">      client.println();<u></u><u></u></p><p class="MsoNormal">      <u></u><u></u></p><p class="MsoNormal">      // send the body<u></u><u></u></p><p class="MsoNormal">      client.println("<html><body>");<u></u><u></u></p><p class="MsoNormal">      client.println("<h1>Arduino Server</h1>");<u></u><u></u></p><p class="MsoNormal">      client.print("<p>A0="); <u></u><u></u></p><p class="MsoNormal">      client.print(analogRead(0)); <u></u><u></u></p><p class="MsoNormal">      client.println("</p>"); <u></u><u></u></p><p class="MsoNormal">      client.print("<p>millis="); <u></u><u></u></p><p class="MsoNormal">      client.print(millis()); <u></u><u></u></p><p class="MsoNormal">      client.println("</p>"); <u></u><u></u></p><p class="MsoNormal">      client.println("</body></html>");<u></u><u></u></p><p class="MsoNormal">      client.stop();<u></u><u></u></p><p class="MsoNormal">    }<u></u><u></u></p><p class="MsoNormal">    delay(1);<u></u><u></u></p><p class="MsoNormal">  }<u></u><u></u></p><p class="MsoNormal">}<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">One potential thing I have not covered is the power supply. I’m unplugging the USB as instructed in the book and plugging in a 9 Volt battery pack – all I have right now for power. I have a 9 Volt 1.5 Amp power supply on order to get here Friday. I’m not sure if that is a problem or not. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I’m running Arduino IDE 1.0.4. The board is Arduino UNO and the Ethernet shield is made by Seeed. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">If this is something someone with more experience could talk about at the meeting I definitely have an interest. I have looked online for solutions but nothing so far has worked. If this topic does not serve the group well, I understand, but maybe someone who has knowledge of this could just give me some directions to get me back on the right path. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Thanks! <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Dwight<u></u><u></u></p></div></div></div></div><br>_______________________________________________<br>
Triangle, NC Embedded Computing mailing list<br>
<a href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a><br>
<a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
TriEmbed web site: <a href="http://TriEmbed.org" target="_blank">http://TriEmbed.org</a><br>
<br></blockquote></div><br></div>