Hello, I have been using two HC-12s with Arduino Unos with RX and TX connected to pin 0 and 1 on both Arduinos and GND and VCC connected to 5V and GND on the arduino. However, I cant get them to communicate after trying multiple methods.
#include <SoftwareSerial.h>
SoftwareSerial HC12(1, 0); // 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
}
}
I have been using the same code on both Arduinos with the sending Arduino I get a blinking TX light whenever I send a message in the serial monitor but the receiver doesn't get anything. To see if it was just a code error I also used the code from this github GitHub - DIYTechBros/HC-12 and still no luck.
To ensure it wasn't a hardware error I used a second pair of HC12s and still nothing. Any help is appreciated!
#include <SoftwareSerial.h>
SoftwareSerial HC12(10, 11); // SRX = 10, STX = 11
void setup()
{
Serial.begin(9600); // Serial port to computer
HC12.begin(9600); // Serial port to HC12
}
void loop()
{
while (HC12.available())
{
Serial.print(HC12.read());
}
while (Serial.available())
{
HC12.print(Serial.read());
}
}
3. Enter Forum in the InputBox of SM1. Check that Forum has apperaed on SM2. 4. Enter Arduino in the InputBox of SM2. Check that Arduino has apperaed on SM1.
okay So I have done this and now I am transmitting but say I put "send" in the serial monitor of one the other just receives a string of numbers "4949534948494949484948484948" which is definitely an improvement but any idea why that's the case?
yea I tried putting it into like an ACII converter to see if maybe I was getting the data in that form but I don't think it would make any sense to receive 11510111010010 when sending SEND
I should also add that I tried changing the setting of the module while connecting the SET pin to GND but even when I type just AT I receive a random string 69828279821310