HC-05 wrong number of arguments error

Hi everybody. I'm trying to connect the HC-05 bluetooth module to my phone but I keep getting this error. Does anyone know what steps I have to take to correct this?

It would help us help you if you gave more information, such as which phone, wat software etc.

This is not an Arduino problem. Arduino is not involved with communication between Bluetooth and phone. IF your phone is an iPhone, and I'm betting that it is, that is your problem. HC-05 is incompatible with IOS, which leaves you with two options:

  1. Put the iPhone back in your pocket, and get an Android to do the real work.
  2. Replace HC-05 with a BLE Bluetooth, thereby keeping the iPhone in service. This may involve some extra code on Arduino, and/or configuration of Bluetooth.

Since the code and your intentions and details are secret, I guess it is also possible that the phone IS Android and will indeed PAIR with HC-05, but the APP you are running is incompatible. Nobody knows what you are up to, but HC-05 is just a plain-vanilla SPP data device. You may even find that the real problem is much the same as 2. above - the app requires a BLE device.

Sorry guys. nothing is secret this is just my first bluetooth project and I'm not sure what information is needed.
My phone is android - Pixel 4A
Code is just to turn on an LED
I have changed the baud rate to several different speeds with the same results
I'm using the MIT app inventor and following along with this youtube tutorial:

Code is as follows:


  // ------- Practice with HC-05 module -------- //
  
  // program turns on and off an LED when a button is pressed on an app
  // Use MIT APP INVENTOR to make app

char Incoming_value = 0;
                
void setup() 
{
  Serial.begin(38400);         
  pinMode(13, OUTPUT);       
}

void loop()
{
  if(Serial.available() > 0)                // check to see if data is available
  {
    Incoming_value = Serial.read();         // place incoming data into the Incoming_value variable
    Serial.print(Incoming_value);           // print Incoming_value
    Serial.print("\n");                     // print new line
    if(Incoming_value == '1')               // check if Incoming_value is equal to 1
      digitalWrite(13, HIGH);               // turn on led
    else if(Incoming_value == '0')          // check if Incoming_value is equal to 0
      digitalWrite(13, LOW);                // turn off LED
  }                            
} 

Thanks for the input

The default baud rate for the HC05 in communication mode (as opposed to AT mode) is 9600, unless you changed it using the AT mode.

I would suggest using SoftwareSerial (for development at least) so as to save the hardware serial port for program upload, program output and debugging. You can't use the hardware serial port for both the HC05 and serial monitor.

Has the HC05 been paired with the Android device? Has the HC05 been connected with the app on the Android device?

Get the HC05 to work with a basic setup, then go on to other things.

Load this basic test code to the Arduino.

#include <SoftwareSerial.h>

SoftwareSerial BTserial(7, 8); // RX | TX

void setup()
{
   Serial.begin(9600);
   BTserial.begin(9600);
   Serial.println("Bluetooth send and receive test.");
}

void loop()
{
   if (Serial.available())
   {
      BTserial.write(Serial.read());
   }
   if (BTserial.available())
   {
      Serial.print(char(BTserial.read()));
   }
}

Connect the HC05 Vcc to Arduino 5V, connect the HC05 ground to Arduino ground, connect the HC05 TX to Arduino RX (pin 7), connect the HC05 RX to Arduino TX (pin 8) through a voltage divider.

I use the Arduino Bluetooth terminal for testing. Pair the HC05 to your Android device and connect the HC05 to the Arduino Bluetooth terminal app. What you send from Bluetooth terminal should show up in the Arduino serial monitor and what ever you send from serial monitor should show up in Bluetooth terminal.

Alrighty, thanks groundFungus, after doing everything you suggested and then double checking everything I'm still getting no connection. Devices seem to pair but not connect. Here are the results. Any sugestions? Thanks

I linked the wrong app. Sorry. Here is the Bluetooth serial terminal app that I use for testing.

Can you install that app and try to connect to it?

YES!!! got it!! thanks so much for your help! I'm gonna mess around with this for a while. Do you have any reference material that would help me understand this any better? I'm just getting started with connectivity and things like that. Again, thanks!

Google "Martyn Currey HC05" or "Martyn Currey Bluetooth". There should be several articles. Those articles helped me to get my modules working. Especially getting AT mode to work so I could set the modules up the way that I needed.

awesome, thanks!