#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
void setup() {
// put your setup code here, to run once:
mySerial.begin(9600);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(mySerial.available() == 1)
{
String val = mySerial.readString();
Serial.println(val);
}
}
Hey! The serial.available is always 0. This is my code. I use SoftwareSerial. The module is powered on 3.3v. GND is connected. RXD connected to ~ 3 digital pin, TXD to 2 digital pin.
My module is similar to HC-05. Same port layout.
also the mySerial.available() is 0 even if i connect my phone with the module and diode in module once connected, it will stop flashing and light up simply.
I do not know if it matters, but when doing this project, the arduino was connected to the laptop via USB, it was not powered by a battery.
Which Arduino Board are you using?
Not sure if original, but Arduino Leonardo.
Please post photos of the Bluetooth modules, front and back.
The correct LED flash pattern if the Bluetooth module is connected is 2 quick flashes every 2 seconds or so.
Withe what Bluetooth device is the Bluetooth module paired? Is the Bluetooth module connected to an app on the sending Bluetooth device? What is the app?
If bluetooth is not connected to my phone, it flashes every 1 second, maybe every 2.
My phone is a samsung s9 edge and I programs the arduino with an old laptop.
Yes, as soon as I connect bluetooth with the application, the LED on it stops blinking.
Arduino bluetooth controller, I also checked other applications that also did not work
edit: The bluetooth module is JDY-31-SPP.
For basic connection and communication between an Arduino UNO and an HC-05, you can see this article.
But behold! Did you say that you got the logic 3.3V version of HC-05 module? Then you need to use a ready made logic level converter or make the following circuit.

I am not familiar with that particular module, but it does say Power: 3.6V -- 6V. I take that to mean that 3.3V is not enough to power it.
I tested your code on my setup of HC05 module connected to an Uno. The HC05 is paired with my laptop (running Win 10) and connected to an instance of the Arduino serial monitor. The serial monitor instance that is connected to the Uno receives everything sent by the laptop. So the code works, but you have a hardware problem.
I think that will need to power the Bluetooth module with 3.6V to 6V to have a hope of getting it to work.
So, this no make short circuit?
They said that they are using a Leonardo which is a 3.3V powered board so the voltage divider is not required on the RX pin.
So, first i try this what you say.
So, this dont work. I dont recive informations.
You incorrectly assume that I know what "this" is. Please describe what you did and the results. If you changed the code, post the latest version.
I haven't changed the code. I did exactly as before but with 5v power I am not getting info in COM8 console. In the COM8 console, literally nothing is sent.
This dont working too, nothing in console COM8
COM8 being the serial port connecting the Lonardo to an instance of the IDE and serial monitor?
Does the LED flash pattern change when powered by 5V?
So, my leonardo isn't orginal. Letter A is full inside.
I have not used a Leonardo board so I looked at the SoftwareSerial reference and found this:
Not all pins on the Leonardo and Micro boards support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
So SoftwareSerial RX on pin 2 cannot work. Change the RX pin to a pin that will work from the list and try it.
Okay, i try ,wait few minutes.