Hello, I recently bought an arruino nano every and a bluetooth module hc-05. I've been trying to communicate from the Arduino to the module for several days with different methods. However, it doesn't work. What should I do?
I moved your topic to an appropriate forum category @vlldr00.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.
Thanks in advance for your cooperation.
These are the connections:
Vcc - 5v
GND - GND
RXD - 10~
TXD - 9~
And here is the code:
#include <SoftwareSerial.h>
const byte rxPin = 9;
const byte txPin = 10;
SoftwareSerial BTSerial (rxPin, txPin);
void setup() {
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
BTSerial.begin(38400);
Serial.begin(9600);
}
char dataByte;
void loop() {
while (BTSerial.available()){
dataByte = BTSerial.read();
Serial.write(dataByte);
}
while (Serial.available()){
dataByte = Serial.read();
BTSerial.write(dataByte);
}
I have only used the HC-05 on microcontrollers with hardware serial ports
with the Nano Every maybe worth trying AltSoftSerial
if you are working on a serious project it may be worth switching to a device such as the ESP32 which has onboard WiFi, Bluetooth Classic and BLE
no jumper leads with poor connections and plenty of libraries with example programs
I know nothing about BTSerial. I do know that pins D9 and D10 are connected to USART3. I wonder: does BTSerial know that?
The Nano Every(unlike the classic nano) has an additional hardware serial port addressed as Serial1 on pins 0 and 1. It is independent of the USB serial port.
It should be used instead of Software Serial.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.