I am not sure where to find resources on how to do this because most tutorials I have found interacts with the HC-06 Bluetooth module through the serial monitor. For example, they change the baud rate of the HC-06 module by sending a "AT+x" command through the serial monitor.
I have an Android application (developed with Flutter) which should communicate with the Arduino via Bluetooth. However, the default baud rate of the module (9600) is not enough because I'm sending a bunch of floating-point numbers through serial.
But I don't want to interact with the serial monitor anymore to change the baud rate of the HC-06. Is there any way to hard code this setting in the code? I've looked into hardware serial but I'm having a hard time comprehending it. I'm planning to deploy my project now and I don't think the serial monitor is of much use in terms of deployed apps.
Is there any way to hard code this setting in the code?
What baud rate will the Bluetooth module be set to initially ?
What baud rate do you want to change it to ?
What is the command to change the baud rate if entered through the Serial monitor ?
Once changed, does the Bluetooth module not retain that rate ? If so then the code to change it only needs to be run once rather than every time the sketch runs. Indeed, once the baud rate has been changed the sketch will no longer work as it will start at the original baud rate and will not be able to communicate
On arduino serial monitor type "AT" (without the quotes) and press enter, "OK" will confirm AT mode. Unlike HC05, you can't see the default name or baud rate. You can only change them. To change name type AT+NAMEDESIRED NAME, notice that there should be no space between the command and name. The module will reply OKyour set name. For example, AT+NAMEPROTOTYPE will set the name to PROTOTYPE. To change baud rate, type AT+BAUDX, where X=1 to 9.
1 set to 1200bps
2 set to 2400bps
3 set to 4800bps
4 set to 9600bps (Default)
5 set to 19200bps
6 set to 38400bps
7 set to 57600bps
8 set to 115200bps
so sending AT+BAUD4 will set the baud rate to 9600.
Your post is incoherent, and you seem to be looking for a problem that doesn't exist. For all that, you CAN do what you describe.
HC-06 is a slave only device and therefore must be addressed by a master, but can only be so when it is good and ready.
It is also in AT mode by default, and stays so until it it starts communicating. This means that you can send it AT commands simply by including them in the setup section, whereby they will be executed every time Arduino starts up, or the reset button is pressed - no serial monitor interaction required, and no funny wiring. This is a legitimate way for configuring Bluetooth, particularly if you wanted to do a swag of them all the same. It's called "one shot".
All you need is a sensible explanation of why you would want to do this, but don't bother until you have re-read reply #1 twice, and have come up with a reasonable definition of "bunch".