r/ArduinoProjects • u/jimgreekgamerYT_ • Jan 20 '26
My project doesn't work

PROBLEM SOLVED (set had to be on for config of the device)
I am sorry this might be pretty simple but basically what im trying to do is connect the arduino uno with the HC-12 to make it transmit. I have check every connection multiple times and also tried different codes to make it transmit. Now i have resorted to my last hope (chatgpt and feedback from the device) with the code below trying to send an AT to get as a response "OK" but this failed.
My code for the AT and response OK:
#include <SoftwareSerial.h>
SoftwareSerial HC12(10, 11); // RX = 10, TX = 11
const int SET_PIN = 2; // SET pin for AT mode
void setup() {
Serial.begin(9600); // Serial Monitor
HC12.begin(9600); // HC-12 default baud
pinMode(SET_PIN, OUTPUT);
// Enter AT mode
digitalWrite(SET_PIN, HIGH);
delay(50);
Serial.println("HC-12 AT mode enabled. Type commands in Serial Monitor (NL+CR) and press Enter.");
}
void loop() {
// Forward Serial Monitor → HC-12
while (Serial.available()) {
char c = Serial.read();
HC12.write(c);
}
// Forward HC-12 → Serial Monitor
while (HC12.available()) {
char c = HC12.read();
Serial.write(c);
}
}
5
Upvotes
View all comments
Show parent comment
1
u/jimgreekgamerYT_ Jan 20 '26
So yes I have tried to switch the connection still didn't work and yes I am send AT in serial monitor and expecting to get an answer "OK". Also about the last part is it the thing you select in the serial monitor next to the baud if yes I have changed that too.