pin questions

I have a MEga 256 with a 5100 ethernet board. I tried to connect a couple of DHT22's to pins 1 & 2 Neither of them worked. Movet to pins 12 & 13 works fine. Can someone tell me what pins are fair game for I/O use? I know there are several that are reserved for the 5100. But what about the others?

Thanks

The W5100 communicates with your Mega 2560 via the SPI bus. If you check Arduino's SPI documentation, you'll find a handy table that shows which pins the SPI bus is on for each Arduino board:
https://www.arduino.cc/en/Reference/SPI
In the case of the Mega 2560, it's on pins 50, 51, 52. In addition to the SPI bus pins, each SPI device also needs to have its own dedicated chip select pin. In the case of the standard Ethernet shields, pin 10 is used for this purpose.

It's not completely correct to say pins 50, 51, 52 are "reserved" for the W5100. The idea of the SPI bus is that many SPI devices can share the same SPI bus pins. The only need to each have a unique chip select pin. Thus, you can connect as many SPI devices to 50-52 as you like, but you can't connect any non-SPI devices to those pins when using the W5100.

As for your problem with using pins 1 and 2: Pins 0 and 1 on your Mega 2560 are used for communication with the computer over the USB cable. You should avoid using those pins for any other purposes. After all, you have plenty other pins to chose from on a Mega! I'm certain that was the cause of your problems with pins 1 and 2, not the W5100.

So Basically I can use 2,3,5,6,7,8,9,11,12,13, 22-49, and all the analog pins. It seems like alot and did when I first started. I have 16 relays connected and that could grow! The statement that the Mega has 56 I/O pins available is a little misleading. Dont' get me wrong I love my Mega. But I might have to get another one to keep up with my future projects around the house.

Thanks

You can use pin 53 as an output. It's the pin that, if the Mega was to be a slave, would be an input pulled low by its master. You don't want that to happen accidentally, since it has to remain master, so make 53 an output. But once it's an output, use it like any other output.

Thanks Neiklot for adding that pin. And I could use pin 4 if I didn't want a SD card. At this point I don't anticipate needing one anyway.