so what happen is when im trying to upload the file, then reconnect the RX and TX as what video say(disconnect them before uploading the reconnect them after) i also sure that my bluetooth is blinking every 2sec. then open the command window to set the correct commands. the Serial Monitor is keep spamming "??????????????????????????????"
what happen next is i try to use AT+ROLE? or ART+UART? but non of them work. it doesnt enter in the command window and it keep spamming and spamming question marks. i wonder what i did wrong?
i follow and copy the codes properly
void setup() {
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
Serial.begin(38400); // Default communication rate of the Bluetooth module
}
void loop() {
if(Serial.available() > 0){ // Checks whether data is comming from the serial port
state = Serial.read(); // Reads the data from the serial port
}
// Controlling the LED
if (state == '1') {
digitalWrite(ledPin, HIGH); // LED ON
state = 0;
}
else if (state == '0') {
digitalWrite(ledPin, LOW); // LED ON
state = 0;
}
// Reading the potentiometer
potValue = analogRead(A0);
int potValueMapped = map(potValue, 0, 1023, 0, 255);
Serial.write(potValueMapped); // Sends potValue to servo motor
delay(10);
}
Unless you changed it, the default baud rate for communication whit the HC05 is 9600.
The baud rate is changed while in AT mode to 38400 in the linked page.
I use a software serial port for my HC05 while developing code and save the hardware serial port (USB) for program upload, monitoring program output and debugging.
weird thing is, this only happen when i remove the RX and TX(since according to video, i should remove it first before uploading then reconnect it after uploading.) then when i reconnect it, it finally stop. regardless, the commands such as AT then AT+UART? are not appearing when entering. aslo in video(not my vide, the guide im following), there is ERROR(0) appearing in Serial Monitor. in my case, it is pure blank even when i enter commands...
The baud rate for communication is 9600 (default). The baud rate is changed while in AT mode to 38400 in the linked page. The baud rate for AT mode is 38400 and is not changeable.
I need to know more about your setup. Ideally I need enough information to duplicate your setup to be able to provide the best assistance.
The page that you linked in your first post is the one that I used to get my modules to work on my Bluetooth controlled 2D plotter, so I know that the instructions work.
potValue = analogRead(potPin);
int potValueMapped = map(potValue, 0, 1023, 0, 255);
bt.write(potValueMapped); // Sends potValue to servo motor
You are sending that out every 10ms with the write() function. It arrives at the other end and is printed as ASCII. Characters with the code above 128 are not printable so show ?. If you adjust the pot towards 0 you should see characters printed.
Im gonna try different video for now. so im following this video instead. so i follow it till the end but still nothing works. what i see something very significant is at 3:15, so 3 things comes different to me. first is even if i enter "AT" or any command, NONE works. also there is no ERROR(0) appearing which appeared on his video. second is i saw his serial monitor to 38400. mine is 9600. whenever i enter on 9600, NOTHING appears but i did enter something since when i click Enter key, the AT disappear in Input box(but again, nothing appear on screen). so i tried to go to 38400 but still, nothing appears.
as for your link, i wonder if i can make it work? i mean my bluetooth has some sort of plastic wrapped around so im not sure how or if it will work and your link is 2014 so i maybe thought that bluetooth modules are little different now.... though ill try it later sometime, nothing bad trying it
To use the HC05 in AT mode the baud rate MUST BE 38400.
So do all of my HC05 modules.
Is your wiring RX to RX and TX to TX to get the HC05 into AT mode using the Uno as a USB to serial adapter. The Uno will have an empty sketch installed. After you are finished with AT mode you will change to RX to TX and TX to RX for regular communication.
i tried to Message you something regarding my product's specifiction. i might be using wrong:
but im not sure the product say it is HC-05 Bluetooth with Backplane
That looks like the HC05 modules that I have. Not exactly the same, but close.
Do you have an Android phone or tablet? You could check to see if they will work by themselves by trying to pair with a Bluetooth device and connect to an app. I use the Bluetooth Terminal app to test my HC05 modules. If you have a Bluetooth device and want to try I will post a testing sketch and instructions. If they work by themselves using the defaults then we might be able to get them into AT mode to do the setup stuff so that they will automatically pair and connect with each other.