Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
If it works on the uno it will work the same on the mega you just pick the pins you need it's not that hard to do the mega only has more pins And 4 serial ports and lot's of flash but any code you can run on the uno runs on the mega too.
And as far as it goes the esp8266 can run uno code too so you really don't need the mega or a uno you just install the needed libraries too use a esp with the arduino ide.
The really only thing the mega has is it has more serial port the uno has only one the mega has 4.
So if the uno code you want play with uses serial just make sure you use the right one.
And the mega has more
Flash Memory 256 KB of which 8 KB used by bootloader
SRAM 8 KB
EEPROM 4 KB