Folks,
I have connected an HC-12 transceiver to an Arduino Nano using pins 10 and 11 for the TX and TX connections. I also connect the set pin on the HC-12 to ground to put it in command mode. I uploaded the following code and brought up the serial monitor. The serial monitor indicates "Enter T commands:.
Typing in AT at the monitor prompt and hitting enter, I do not get back the expected okay on the monitor. The baud rate appears to be correct at 9600. Can someone please help? Thanks.
Brian
//HC-12 AT Commander
//Autor Tom Heylen tomtomheylen.com
//The HC-12 commander mode runs at baud rate 9600
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
void setup() {
Serial.begin(9600);
Serial.println("Enter AT commands:");
mySerial.begin(9600);
}
void loop(){
if (mySerial.available()){
Serial.write(mySerial.read());
}
if (Serial.available()){
mySerial.write(Serial.read());
}
}