Increasing outputs

Hi all,

I am looking for simple solution to allow me to run more than the maximum number of outputs from an Arduino Mega board by connecting it to secondary board.
What communication protocol do I need between the boards and can I have an example of code needed.

thanks

What type of output do you need (digital/analogue), what current must each output sink and how fast do the outputs need to switch?
You can easily expand digital outputs using serial shift registers and they will only need 2 or 4 (depending on serial protocol) Arduino pins to drive multiple chips.

EDIT:
See this

You can google I2C PWM and I2C port expander; I2C can be replaced by SPI.

For analog you can search for e.g. Arduino ADC breakout or replace Arduino by I2C or SPI.