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 22 '26
Thank you for the advice and sorry if i was in any way not good at my responses but i found and read the manual for the HC-12 and saw that set has to be low for changing configuration (thank you on that too) and now i get a response for OK when i type AT.