Android Question Send data to Ottody whit arduino board

Ekko

Member
Licensed User
Longtime User
Hello everyone, I have an Ottody robot that I built. I am trying to modify this example https://www.b4x.com/android/forum/threads/b4xpages-bluetooth-chat-example.119014/#content to create an application that controls it.
I have already gotten it to show the bluetooth devices to connect and it works fine. Now from the second screen I need to send him the orders to make the movements.
For example:
It would be something like "\nM 8\n", where \n is a line break, those breaks are necessary for it to understand the command, if I command "M 8" it doesn't work.
How can I send that data? I'm stuck, there's only that left for me to keep moving forward.
Thank you
 

sirjo66

Well-Known Member
Licensed User
Longtime User
Are you sure that the first line break is necessary ??
Try with "M 8\n" or "M8\n"
Also, you can try to change "\n" with Chr(10)
 
Upvote 0

Ekko

Member
Licensed User
Longtime User
Hello, thanks for the information. I already achieved it with the following code.
B4X:
B4XPages.MainPage.SendMessage("H 8" & Chr(13))
.

I was wrong, it was not M 8 but H 8 and at the end of the command it needs a carriage jump \r.
Now it works perfect.
Thanks again
 
Upvote 0
Top