Ethernet shield problems

Fairly new to the arduino world so any help, comments or suggestions would be greatly appreciated.
I’m currently working on a project that controls my garage door via 4x4 keypad or ethernet shield. I can get
the keypad and the ethernet shield to work correctly by them selves but when I combine the two into one program
the keypad doesn’t recognize all keys pressed and process controls. I think this might have something to do with pin 4 being
used by the ethernet shield.
any suggestions would be great

working_lan_with_keypad_100714.ino (5.24 KB)

  digitalWrite(17, HIGH)


void loop(){
  //Serial.println("Loop entered");
  keypad.addEventListener(keypadEvent); //add an event listener for this keypad

Read to see if there is a key pressed, but ignore the key if one is pressed. So, why are you bothering to read?

Why are you adding the event listener again and again and again and again?

            digitalWrite(17, LOW);    // set pin 6 high

If you are going to have useless comments, you MUST keep them accurate.

The code you posted does something. You did not say what it does.
You expect it to do something. You did not say what that is.

I think this might have something to do with pin 4 being
used by the ethernet shield.

So, don't use pin 4. The analog pins can be used for keypad pins, just like you are using 14, 15, 16, and 17. You still have 18 and 19.

Don’t know if these are all your problems, but some of them anyway.

Your Ethernet.begin() call is not correct.

  // this 
  Ethernet.begin(mac, ip, gateway, subnet);
  // should be this
  Ethernet.begin(mac, ip, gateway, gateway, subnet);

And you may be running out of SRAM if the shield is connected to an Uno. Use the F() function to save on SRAM.

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

Unless you are using a SD card in the shield’s slot, using D4 will not cause a problem.

Thank you for you help. Still looking for the needle in the haystack of little issues that keeping the two from working together. Post by another did help get me a little closer to working. Merging sketches together I did put a call in twice to check keypad inputs and it was throwing it into a bad loop.

Take the addEventListener call out of the loop. That should be called only once in setup.

Could this be overflowing the password array?

	  default: password.append(eKey);

Where does the sketch fail? What are the symptoms? Does it freeze or keep running? What is the serial monitor output when it fails?

Did you use the F() function to reduce your SRAM use?