Arduino with Bluetooth problem

I have a problem with my Bluetooth module on my arduino, I am trying to do a door that opens with a button in an application in the phone but when I press the button in the app the door doesn't move

#include <SoftwareSerial.h>
#include <Servo.h>
int mover;
int mover2;
int pinBluetoothTX=10;
int pinBluetoothRX=11;
Servo servoMotor1;
Servo servoMotor2;
char rxChar;
SoftwareSerial bluetooth(pinBluetoothTX, pinBluetoothRX);
void setup(){
pinMode (4,INPUT);//Fin de carrera 1
pinMode (2,INPUT);//Fin de carrera 2
pinMode(pinBluetoothRX, INPUT);
pinMode(pinBluetoothTX, OUTPUT);
mover=90; //0 Abrir 180 Cerrar 60-120 Velocidades
mover2=150;//motor Cerradura
servoMotor1.attach(8);//Motor Pin8
servoMotor2.attach(9);//Motor Pin9
void loop() {
 int lectura; 
 int lectura2;
  lectura=digitalRead(4);//fin de carrera
  lectura2=digitalRead(2);//fin de carrera
  bluetooth.available() ;       //Espera un carácter
      char rxChar =;    //Lee carácter y lo borra del buffer
      Serial.println(rxChar);             //Imprime código ASCCI de caracter
   Serial.print("60 Grados");
   Serial.print("120 Grados");
  if (lectura==LOW and mover==120){
    mover=90;//motor frena
    mover2=30;//Motor Cerradura Cerrado
  if (lectura2==LOW and mover==60){
    mover=90;//motor frena

What Bluetooth module?

What Arduino?

Is the Bluetooth module paired with the Bluetooth capable device?

Is the Bluetooth module connected to the app on the Bluetooth device?

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Have you tried connecting to an app like Bluetooth Serial Terminal?

Can you post a schematic showing how the project is wired?

First guess:

When calling SoftwareSerial, RX pin of Arduino comes first (Tx of the module). Make sure those pins are correctly set up.

@groundFungus questions would help a lot in troubleshooting.

Here is my test code for a HC05 Bluetooth module and the Bluetooth serial terminal. Adjust the pins as necessary for your setup. Use this simple code to make sure the Bluetooth module is connected and working.

//Sends from serial monitor to the Bluetooth device app
// receives from the Bluetooth device app

#include <SoftwareSerial.h>
SoftwareSerial BTserial(4, 7); // pin 4 to BT TX, pin 7 to BT RX
                               //  through voltage divider

void setup()
   Serial.println("Bluetooth test program");
   BTserial.println("Bluetooth test program");

void loop()
   if (Serial.available())
   if (BTserial.available())
 bluetooth.available() ;       //Espera un carácter
   char rxChar =;    //Lee carácter y lo borra del buffer

You are not doing serial input correctly. Your bluetooth.available() is doing nothing. I would suggest that you have a look at the serial input basics tutorial to see how to use the avaiable() function and how to receive serial data. Example 1 - Receiving single characters does just what you need.

The Bluetooth module is HC-06
the Arduino is an Arduino Uno

I tried this code and the monitor is returning this:

every "⸮" is supposed to be a character

What is the sender? The Bluetooth serial terminal or your app? I tested the code with the Bluetooth serial terminal and it does work fine.

I solved it, the problem was the bluetooth module, it had a different bps

Calls for help like this one are becoming more frequent. Someone builds a phone/Arduino project based on a tutorial or kit. It doesn't work and they come to the Arduino or MIT AI forum asking "what's wrong?".

All the elements to make such a project work are well described in many places.

The discussion we are in right now encompasses pretty well all the key points in troubleshooting an app/Arduino problem.

I would like to suggest that anyone wanting to know why their MIT App Inventor app isn't working correctly with their Arduino kit are referred to this discussion. They should only call for help after they have checked off everything in this discussion and still can't get things right.

What do others think about that? Do you not get tired of asking the same questions, making the same suggestions?

Sounds like a good suggestion. But it´s not that easy to find this exact topic when looking for it in Google.

Maybe it should be better if someone try to do a specific topic that everybody references, just as what has been doing with this "Serial Imput Basics" that @groundFungus mentioned. I´ve seen many many references to this topic everytime that someone asks about dealing with received messages or exchanging information through Serial Monitor.

Agree, the topic name is not the best description.

I feel all the components of an Arduino/app project are well described in many places. I wonder if a simple list of the components is all that's needed, at least in the short term.

I guess I am hijacking the OP's topic. I will post the question in a new topic.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.