Arduino Uno Sketch on other Arduino's

I'm pretty new to this so bear with me. So I have an Arduino Uno and started developing a sketch. I'm noticing I may need more GPIO ports and possibly an Ethernet port.

I have 2 options - 1: get a port expander chip sold on Adafruit, and an Ethernet Shield.
2: get an Arduino Mega

So the question is, can I upload the same sketch used on the Uno and continue on with the Mega? I haven't seen much mention of the Mega so I'm not sure if it is a different animal altogether or a part of the same family.

Almost the same.
You select your new board in the Arduino IDE, let it compile, upload it, and it might just run.

There are a few things.
The pins for the I2C bus are in a different location, and you can no longer use 3.3V I2C devices on that I2C bus.
The internal reference voltage is a little different, less pins for state-change-interrupt, other pins for pwm and interrupt and SPI, and a few more small things.

But in most cases, it's easy to transfer from Arduino Uno to Arduino Mega 2560.
What kind of pins are you using at the moment, and what for ?

Peter_n:
Almost the same.
You select your new board in the Arduino IDE, let it compile, upload it, and it might just run.

There are a few things.
The pins for the I2C bus are in a different location, and you can no longer use 3.3V I2C devices on that I2C bus.
The internal reference voltage is a little different, less pins for state-change-interrupt, other pins for pwm and interrupt and SPI, and a few more small things.

But in most cases, it's easy to transfer from Arduino Uno to Arduino Mega 2560.
What kind of pins are you using at the moment, and what for ?

Thanks Peter, primarily I will be utilizing just the digital pins to set relays on and off. The other things you mentioned I'm not too familiar with. I originally started with a Raspberry Pi but found it tedious to use it's digital GPIO's to function properly, so here I am.

Yes the answer Peter_n is very clear. What about the price? What is the cheapest option?

BTW, I found that many user of this forum are using this kind of device too (instead of the ethernet shield):

luisilva:
Yes the answer Peter_n is very clear. What about the price? What is the cheapest option?

BTW, I found that many user of this forum are using this kind of device too (instead of the ethernet shield):
Mini ENC28J60 Ethernet LAN Network Module | eBay

I came across this as well yesterday, it's funny that you posted it. I heard however it doesn't use the same Ethernet library. Can you confirm?

You can look at Atmega1284P.
Dual hardware serial, 32 IO, 16K SRAM, 128K Flash.
Not as costly as a Mega,and if you happen to zap the uC you can replace it.
I offer boards in a couple of form factors:
http://www.crossroadsfencing.com/BobuinoRev17/
1284 core files & bootloader:
http://forum.arduino.cc/index.php?topic=235521