BotronikS: Final code for all types of Arduino and PC users -- HOME -- Email: botronik@gmail.com

 
     
RF communication between Arduino with HC-12 module - state transfer of 4 switches
You need 2 sets - one as a transmitter (Tx) and the other as a receiver (Rx) - Tx or Rx is determined by switch (STR)
Range: depends on Baud, used antennas, and nature of the obstacle between the antennas... (10-1000m)
Download the HEX codes below, unpack and upload to the proper Arduino board (Use a free net tool for example XLoader)
1. ATmega328-16MHz (NANO,UNO...........): - HexCode-m328
2. AtMega2560 (Mega(ATMEGA2560)......): - HexCode-m2560
 

SBR=Baud select: open=9600 (HC12 default) closed: 2400 (for long range) - need restart if change!
Note: When you change the SBR, the HC12 must also be reprogrammed!
STR: Operating mode selection open=receiver closed=transmitter - need restart if change!
At the transmitter: the state of the switch S1-S4 is transmitted to the receiver
At the receiver: the state of the output follows the state sent from the transmitter
Reaction delay: 1-2 sec.