New network setup, same program, now won't work

I have either a memory or network settings issue.

This code worked fine on these network settings at let’s say location “A”:

location “B” is simply a different network of which I also know and control the gateway, now it is just
ip: 192.168.1.

Now it won’t work. It has worked at location “B” before, however I had to give back the long ethernet cable I was using to connect to my wireless router. In location “B” I now connect to the switch with a shorter cable versus direct to the wireless router. Cable works otherwise (tried with laptop).

The other difference is I had to migrate my IDE to a new laptop and migrate over my program library files. That must have worked because it doesn’t moan at me about compile errors for the custom X10 library stuff (or any other commands).

Since it worked with no changes other than network setup and this laptop, I’m inclined to believe it has to do with it being hooked up to the switch versus directly to the wireless router.

The only other hint I have seen searching online is that the program might be too large for the Uno R3 memory. It says it sits at 17.5kb out of like 34kb available. Which seems fine, but also seems large one way or another.

I hope somebody can find a stray character or something. Code is below.

  Web Server 

#include <SPI.h>
#include <Ethernet.h>
#include <X10Firecracker.h>
#define RTS_PIN     2                   // RTS line for C17A - DB9 pin 7
#define DTR_PIN     3                   // DTR line for C17A - DB9 pin 4
#define BIT_DELAY   1                   // mS delay between bits (1 mS OK)

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x7B, 0xD4 };
IPAddress ip(192,168,1,75);
byte gateway[] = {192,168,1,1};
byte subnet[] = {255,255,255,0};
byte fireplace = 0;
int indoortempraw = 0;
float indoortempval = 0;
char indoortempvalstr;
int outputpin7 = 7;
int outputpin6 = 6;
int outputpin5 = 5;
int outputpin4 = 4;
byte heaton = 0;
byte acon = 0;
float tempstpt = 0;

// Initialize the Ethernet server library
// with the IP address and port you want to use 
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup()
  X10.init(RTS_PIN, DTR_PIN, BIT_DELAY);  //
  Serial.begin(9600);    //  open up serial port connection to PC
  // start the Ethernet connection and the server:
  pinMode(outputpin7, OUTPUT);
  pinMode(outputpin6, OUTPUT);
  pinMode(outputpin5, OUTPUT);
  pinMode(outputpin4, OUTPUT);
void loop()
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    String buffer = "";  //  Declare the buffer variable

    while (client.connected()) {
      if (client.available()) {
        char c =;
        Serial.print(c);  //  Send every character read to serial port 
        buffer+=c;        //  Assign to the buffer

        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("<body background=\"\">");
          client.println("<font color=white><h1 align=center>8204 Shadowstone Ct. Home Command Page</font></h1>");
          client.println("<hr />");
          client.println("<hr />");

          if (digitalRead(8)){  //  1<-- Display LED status
            client.println("<img src=\"\" width=20 height=20 />");
            client.println("<img src=\"\" width=20 height=20 />");
          // 2<-- Create a form, control output 8
          client.print("<FORM action=\"\" >");
          client.print("<P> <div align=left><INPUT type=\"radio\" name=\"status\" value=\"1\">ON" "<INPUT type=\"radio\" name=\"status\" value=\"0\">OFF" "<INPUT type=\"submit\" value=\"  Yellow LED \"></div>" "</FORM>");
          if (fireplace==1){  //  1<-- Display LED status
            client.println("<img src=\"\" width=20 height=20 />");
            client.println("<img src=\"\" width=20 height=20 />");
          // 2<-- Create a form, control output 7
          client.print("<FORM action=\"\" >");
          client.print("<P> <div align=left><INPUT type=\"radio\" name=\"status2\" value=\"1\">ON" "<INPUT type=\"radio\" name=\"status2\" value=\"0\">OFF" "<INPUT type=\"submit\" value=\"  Red LED \"></div>" "</FORM>");
          //client.println("Indoor Temperature: ");
          client.println("<P> <div align=left><img src=\"\" width=480 height=360 />" "<img src=\"\" width=480 height=360 />");
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
          buffer="";       //  Clear the buffer at end of line
        } else if (c == '\r') {            
          if(buffer.indexOf("GET /?status=1")>=0)
            digitalWrite(8,HIGH);  // Catch ON status and set  Yellow LED
          if(buffer.indexOf("GET /?status=0")>=0)
            digitalWrite(8,LOW);  // Catch OFF status and set Yellow LED
           if(buffer.indexOf("GET /?status2=1")>=0){
          X10.sendCmd( hcA, 2, cmdOn );
          if(buffer.indexOf("GET /?status2=0")>=0){
          X10.sendCmd( hcA, 2, cmdOff );
          indoortempraw = analogRead(A0);
          indoortempval = (float(indoortempraw)/1023.0*257.0);
            acon = 1;
            heaton = 1;
          if(acon == 1){
          if(heaton == 1){
        else {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
    // give the web browser time to receive the data
    // close the connection:

If you are running out of memory, try using the F() macro like below on the static text strings.

          client.println(F("HTTP/1.1 200 OK")); //send new page
          client.println(F("Content-Type: text/html"));

          client.println(F("<TITLE>Arduino GET test page</TITLE>"));

          client.println(F("<H1>Zoomkat's simple Arduino button</H1>"));
          client.println(F("<a href='/?on'>ON</a>")); 
          client.println(F("<a href='/?off'>OFF</a>")); 


I have mentioned this once already today. The other user said "this works", and now you say it used to work and now doesn't. He just hasn't moved his Arduino to another network yet. ;)

// this is incorrect for V1.0 and later
// it should be

If the netmask is used for the gateway, the Arduino will not be able to route packets out that gateway, so would only be available on it's localnet, and no others.

I hooked my laptop up to the switch that lies between the wireless router and the project. I was not able to have connectivity with the laptop. Looking at this now, and how the wireless router is designed, I would have to have an extra cable between the wireless router ports and the switch which I do not have.

Instead I took the time to move the project and plug it into the wireless router, works now.

Otherwise, yes, I have had issues running out of memory, and have not tried F() yet. Just today, I noticed it got very buggy or totally non-responsive to webpage input if I added my field for "Indoor Temperate: somefloat". I will work with the F() functionality and see if that helps me.

If I want a 'larger' or 'nicer' webpage to interface with, should I consider going to the SDcard based webserver or something else altogether?

I feel I'm already at the end of the rope here with just a few radio buttons.

Will the F() functionality save me a ton of memory?

I want the webpage to have: -20 radio buttons -about 5 float pt number displays -several user text and float input fields

Also, when viewing html tutorials I notice the syntax here is very different. What gives with the vast amount of quotes " " and \/ forward or backslashes present in the arduino client.print commands?

for print control.. Embedded C and C++ print statements use different syntax than non embedded code does. Among other things.