I am trying to get a HC-12 to send sensor data to another HC-12 using 2 Arduino Uno's. I found a simple sketch on the internet that claims I can enter something in one of the serial monitors and it will appear on the other serial monitor. This seems to only work one-way. If I enter something in the serial monitor of Arduino"A" it will appear on the serial monitor of Arduino"B". However, if I enter something in the serial monitor of Arduino"B" it does not show up on the serial monitor of Arduino"A". I took it a step further by hooking up a GPS to Arduino"A" and it indeed spits out NMEA sentences on the serial monitor of Arduino"B".
Do HC-12's only communicate(transmit) one-way?
I am using the below code found at www.HowToMechatronics.com:
#include <SoftwareSerial.h>
SoftwareSerial HC12(10, 11); // HC-12 TX Pin, HC-12 RX Pin
void setup() {
Serial.begin(9600); // Serial port to computer
HC12.begin(9600); // Serial port to HC12
}
void loop() {
while (HC12.available()) { // If HC-12 has data
Serial.write(HC12.read()); // Send the data to Serial monitor
}
while (Serial.available()) { // If Serial monitor has data
HC12.write(Serial.read()); // Send that data to HC-12
}
}