Hi, I have problem to connect two Hc-12 modules. Below is my code for both of them. I set both of them like this
OK+B9600
OK+RC050
OK+RP:+11dBm
OK+FU3
but when i try to send message from one to the other i have an error.
VCC- 5v,
GDN-GDN
SET-GDN
when i take out set from GDN I cant do anything
UNO
#include <SoftwareSerial.h>
SoftwareSerial HC12(10, 11); //10 FOR rx,11 tx
void setup() {
Serial.begin(9600);
HC12.begin(9600);
}
void loop() {
while (HC12.available()) {
Serial.write(HC12.read());
}
while (Serial.available()) {
HC12.write(Serial.read());
}
}
NANO
#include <SoftwareSerial.h>
SoftwareSerial HC12(2, 3); //10 FOR rx,11 tx
void setup() {
Serial.begin(9600);
HC12.begin(9600);
}
void loop() {
while (HC12.available()) {
Serial.write(HC12.read());
}
while (Serial.available()) {
HC12.write(Serial.read());
}
}