This routine is divided into sending and receiving part. The sending terminal consists of SUNFOUNDER MEGA 2560, five keys, and NRF24L01 module. The receiving terminal consists of SUNFOUNDER NANO, 4-channel relay module, and NRF24L01 module. The five keys on the sending terminal are defined as sw1, sw2, sw3, sw4, sw5. The first four keys are corresponding to the four channels on the relay module of receiving terminal. The sw5 key is close key. When pressing any keys on sending terminal, the corresponding relay channel on receiving terminal will conduct. When pressing sw5, all the relays will be disconnected.
SUNFOUNDER MEGA2560 * 1
SUNFOUNDER NANO * 1
NRF24L01 * 2
4-channel relay module * 1
Breadboard * 1
USB Cable * 1
First, connect the circuit
One end of the SW1 to SW5 is connected to pin 2 to 6 of SUNFOUNDER MEGA2560, the other end of them is connected to GND.
Second, program (Please refer to example code in CD we provide)
Third, compile the program
Fourth, burn nrfTest_send into SUNFOUNDER MEGA2560 and nrfTest_receive into SUNFOUNDER NANO, the physical connection is shown below: