Hi, I am creating an app using mit app inventer where I would control stepper motor using microcontroller and hc 05 bluetooth module. I ran into a problem of connecting the phone tog bt module, when I get the list of nearby devices and click on hc 05 It says error 507, is your device on, smth like that. I'm guessing the problem might not be with the module since I am unable to connect to other devices. This is just a starting design in order to see if it would work. Any help would be much appreciated. Thanks in advance.
Ps. If the phone model is important(samsung galaxy a54)
Dear @Bruno_Dragas,
honestly it's a bit confusing when you say that : "the problem might not be with the module since I am unable to connect to other devices" . (probably you wanted say able ?).
Anyway, to start from a securely working situation you could have a look to @Juan_Antonio's web site (kio4.com) where you can find a huge quantity of ready made code (both AI2 and Arduino) from where you can start and then develop yours. In other words: after you have succeeded to run one of the kio4 examples, you are sure that the hardware is working fine, and then you can go on with your own app.
EDIT: having a look to your AI2 blocks, I see that you have a clock that checks for the BT connection. Is the clock already enabled at app start ? If yes, this could be the error: such a clock shall be enabled only after the BT device has been already successfully linked otherwise it tries to verify a connection that is not effective yet.
Typically a clock is used to verify whether some characters have been received on the BT line, but obviously only after the BT is surely operating.
Hi, thanks for yur reply.
I meant to say that I was unable to connect to any other device so I am thinking it has nothing to do with the module rather, it might with he phone or the code?
Hi, yes I agree.
But what I suggested was to use one of his examples, so to be sure that your hardware is working fine.
Once you are done with that, you can implement whatever code or blocks you want but until you aren't sure that the hardware works well, you run the risk to search into the software a problem which is in the hardware instead.
Hi, before my real project I decided to try with smaller one to see if it works, controlling the led. I was unable to do so, button doesn't do anything, there is no message on serial monitor... so I wonder where is the prob
You check for character '0' or '1' in your sketch:
But you do not send character '0' or '1'
You send 0x00 and 0x01 values.
Look in an ASCII Table for the hex values of character '0' and '1':
They are 0x30 and 0x31.
Since you are testing for character '0' and '1', it is easier to use the AI2 block that sends text '0' or '1'.
You might have to put those ReceiveText blocks in a Clock Timer, since it takes time for the send '0' or '1' to reach the Arduino and for it to respond and for the response to arrive in your app, and the ReceiveText may have completed empty handed.