Hi everyone, please help me. I want to build a wi-fi remote control car for my little sister but I want to built it control panel in an application on her android phone, but I don't know how can I built this app. please hint me and here is my source code for this app. (to see its source code click on My app source code or click on attached file)
The problem is when I touch the panel I want to show its toast massage until I release it, but it don't work as I want. My app source code
Thanks a lot walt61
but now I have a new problem I want to detect which panels will be touch at a same time and then decide what to do
I write a function for this but seem it doesn't work currently so I need your help once more again. here is my code
Before you go any further you need to understand how this forum works. This is outlined in this post at the top of this forum page. In particular always start a new question in a new thread, and use the code tags (</> in the menu above) to post your code example.
Please use File/Export As Zip to create a zip file with your project, it will omit most of the Objects folder and the AutoBackups folder. It will also result in a zip file <512Kb and you'll be able to attach it straight to the post.
Your 'detect' code is wrong:
- 'a And d' performs a logical 'And' on these values and results in a Boolean (True or False), and you want to detect the condition 'both values are 1'
- your first test was 'If a = 1'; if that condition was satisfied, you'd never reach e.g. the 'And d = 1' bit
It should be:
B4X:
Sub detect
If a = 1 Then
If c = 1 Then
Log("Go front left")
Else If d = 1 Then
Log("Go front-right")
Else
Log("Go front")
End If
Else If b = 1 Then
If d = 1 Then
Log("Go reverse-right")
Else If c = 1 Then
Log("Go reverse-left")
Else
Log("Go reverse")
End If
Else If c = 1 Then
Log("Go left")
Else If d = 1 Then
Log("Go right")
Else
Log("STOP")
End If
End Sub
The attached version makes your code more compact (and elegant ) and was exported as zip (making the zip only 10Kb).
In Designer, these changes were made too:
- set the 'Tag' property for the 4 panels to 'Left', 'Right', 'Front', 'Reverse'
- changed the 'Event Name' property for the 4 panels to 'k' so that they share the same event
The attached version makes your code more compact (and elegant ) and was exported as zip (making the zip only 10Kb).
In Designer, these changes were made too:
- set the 'Tag' property for the 4 panels to 'Left', 'Right', 'Front', 'Reverse'
- changed the 'Event Name' property for the 4 panels to 'k' so that they share the same event
Hi, walt61.
Thanks a lot for your answers and support.
I finally made my own control app for my wifi remote car and here is the most stable version of my app.
I send it for you to thank you and see my app. I create two link of this file in my google drive because it's uploaded twice in a same time and I couldn't understand which one is the real file. first link second link
And the library I used to create some of the control's mode.