djsfantasi
- Joined Apr 11, 2010
- 9,156
Yep! I see that in the datasheet now.hi dj,
The SET line has an internal pull up, so when the pin is o/c it is in the TX/RX mode, you have to pull and hold the SET pin Low to program the HC".
E
Yep! I see that in the datasheet now.hi dj,
The SET line has an internal pull up, so when the pin is o/c it is in the TX/RX mode, you have to pull and hold the SET pin Low to program the HC".
E
Incidentally, note that software serial 'RX' should connect to HC12 'TX', and vice versa.
In reading through this thread again, I’m not sure that this question was answered.And in regards to the pin connections is it mandatory for HC12 'RX' & 'TX' pins to be connected to the dedicated ones on the arduino for sending commands, ...
That would be great thank you, I tried to upload the arduino IDE documents as an attachment but it wouldn't allow it so ive had to copy in the code for ya...hi K,
If you post your Arduino code as an attachment, I can test your code and maybe add the AT commands.
I have a UNO +TFT+HC12 running on test on my PC at this time.
E
//HC-12 AT Commander
//Autor Tom Heylen tomtomheylen.com
//The HC-12 commander mode runs at baud rate 9600
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // TX,RX
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());
}
}
#include <SoftwareSerial.h>
const byte RX = 11;
const byte TX = 10;
const byte SET = 8;
SoftwareSerial HC12 (TX,RX); //create software serial port
void setup() {
// put your setup code here, to run once:
// pinMode(RX,INPUT);
// pinMode(TX,OUTPUT);
pinMode(SET, OUTPUT); // Output High for Transparent / Low for Command
Serial.begin(9600); //open serial port to computer
HC12.begin(9600);// open serial port to HC-12
Serial.println("Hello World - Software Serial");
}
void loop() {
digitalWrite(SET, LOW); // Set HC-12 into AT Command mode
delay(100); // Wait for the HC-12 to enter AT Command mode
HC12.print("AT+RX"); // Send AT Command to HC-12
delay(200);
while (HC12.available()) { // If HC-12 has data (the AT Command response)
Serial.write(HC12.read()); // Send the data to Serial monitor
}
}
Awesome thanks!hi K,
Downloaded those two files, will post back later on how they go.
E
Because he is using two serial ports and may only have one hardware TX/RX? The hardware serial port is already used for debugging and reading/writing from/to the HC12. And the hardware serial port is already tied to the console.BTW: Why are you creating a software serial port rather than using the hardware TX/RX.?
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
R | Help with Basic Circuits | General Electronics Chat | 44 | |
What am I doing wrong with the lm317? | Power Electronics | 16 | ||
Help in reading "basic" THD graphs | Homework Help | 7 | ||
Newbie need help identifying basic potentiometer | General Electronics Chat | 19 | ||
L | Need some basic power supply help! | General Electronics Chat | 6 |
by Duane Benson
by Jake Hertz
by Jake Hertz