Radio Frequency HC-12. Arduino. Bluetooth HC-06

6.- More range. FU4 mode. AT commands.

  • The greatest range 1800 m (1.1 mile) is obtained in FU4 mode.
    To configure it in that mode, we connect the SET terminal to pin 9 of the Arduino and load the following code.

#include <SoftwareSerial.h>
SoftwareSerial HC12(10,11); // TX to pin_10. RX to pin_11 of Arduino.

void setup() {
  Serial.begin(9600); // 9600 viene por defecto. 1200 en modo FU4
  HC12.begin(9600);   // 9600 viene por defecto. 1200 en modo FU4
  pinMode(9, OUTPUT); // SET to pin_9 of Arduino.
}

void loop() {
    if(Serial.available()) {   
    String command = Serial.readStringUntil('\n');
    digitalWrite(9, LOW);
    Serial.println(command); 
    HC12.print(command);
    digitalWrite(9, HIGH);
    }
 
   if (HC12.available()){
   String retorno = HC12.readStringUntil('\n');
   Serial.println(retorno);
   }
}

AT
AT+RX
AT+FU4
AT+RX