How to control a DC motor via Arduino Uno as a slave and Mega 2560 as master?
Serial is quite easy to implement and use the SoftSerial.

Example code for serial can be found in the Arduino IDE under the menu:

File | Examples | 04. Communication