Mobile control app with bluetooth for toy car buttons

I'm doing a robocar project which you can control through Bluetooth with your phone. I'm having some trouble with making an app for android devices. The idea is that when you hold down a button, a signal will be fire continuously from the android devices which instructs the motor to move in a specific direction.
In my case, the letter "F" signal means forward, letter "B" signal means back, letter "L" signal means left, letter "B" signal means backward. but my app design, in direction specifically, doesn't seem to work, can someone help me point out the problem? where i went wrong, and how to fix it? it'd be much appreciated

some more info: when the button is hold, the car must proceed to move in said direction until user let go. and my code and my circuit design is provided by my instructor so it's not likely be the problem.

Here's my direction design:

Try it:

1 Like

hello Patryk_F and thank you for replying, but unfortunately, your solution doesn't work either. specifically, after I have established connection with my pc, when i hold (or press) the button, nothing happened.

Have you noticed there are red errors in your app? There are no red bugs in my blocks as you can see. Why do you think they appeared in your blocks?

oh yeah, right... silly me, i forgot to add initialize global command. After having done that, it doesn't show any errors. But the result is the same, nothing happened. Can I have yours though?

Another problem is the use of "gotFocus" for buttons. I have "touchDown" and "touchUp".

Now this is akward... sorry man, i'm a bit clumsy.
But it finally work man, you're a genius, I couldn't thank you enough.
really sir, really appreciated. <3

1 Like

Hey man, can I ask you something. Your design works fine, but when the wheels increase to a certain value (each wheel has a motor value number, which will increase when the car goes forward). The value it around 16 ~ 25, it got slower and slower then stop . like, the number show a rapid increase and decrease that it stays at the same value. But, this time, the problem could be in my code in proteus and not in the design. Still, i'd be glad to hear what you think?

I do not know what frequency of sending data may be appropriate in your case. Perhaps 100ms is too fast? Perhaps the buffer is overflowing and hence the problems? Experiment with TimerInterval. Or, after the device receives data, clear the buffer on the device. In any case, I think the problem may be with the device.

thanks for your reply. Some alternation in the code did the trick for me, thank you for having been so patient and dedicated

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