I have created an app to control a robotic arm via Bluetooth (HC-05) and Arduino. The following is the screenshot showing a block related to the switch.
When the switch is on it has to send "O" and when the switch is off, it has to send "N". But on every toggle of the switch I am getting different characters starting from " % + . 1 4 7 : = ? each on every toggle, on my serial monitor of Arduino. In the end, I am continuously receiving only ? and how manytimes I do the toggle of the switch, there is no change.
If I am sending any message from the Ardunio to my app, the following error messages are received in the app.
I am using software serial to connect both the computer serial and the HC-05 serial to Arduino. I have tried two different communication rates 9600 and 38400. If I give 38400 as the baud rate for both the serial and software serial, only then I am at least some message. In all the other cases there is no communication at all. Please help by letting me know what is the mistake I did and how to rectify it. If more information is needed, I shall provide.
I see some inconsistency in the code. What arduino do you use? To which pins do you have the bt module connected?
The rule is that the terminal and bluetooth cannot work on the same serial port. I see that bluetooth should be on pins 3 and 4. Bluetooth is set to a baud rate of 38400. Unfortunately, there are modules that have the factory set to 9600. Change the value to 9600. The second thing is the uart for the terminal is set to 9600 in the code, while on the screens I can see that you are using 38400.
I used 38400 in the terminal used the same in the serial.begin. With commands from the serial monitor, it is working without any issues. The control is fine. The only issue is with the bluetooth transmission/reception.
I do not know what you're talking about. Preferably show screenshots or photos to better give feedback. Without it, it's hard to help. I have to guess what it looks like at the moment, instead of just seeing it.
I see in your code for arduino 9600, not 38400. So I don't know what you're talking about. After my modifications I think your blocks for appinventor are correct. Chars are sent correct. The problem is with your arduino code not properly processing the received data. That's why I think now you should seek help on the arduino forum and tweak your code.
I have tried different speeds. But I ensured that I have used the same speed in the serial monitor as that was used to initialize using Serial.begin(). That was not a problem.