My project has 4 buttons of motion (F = FRONT, RIGHT = D, E = LEFT, Behind = T)
and 1 push button (START = S).
sasa
Every time I click on move buttons, I want it to store the button was clicked,
So just when I click the START button, clicked run the commands and send the text (F, T, D, E, F, D) commands to the Arduino by Bluetooth
who knows how to mount these Blocks?
and 1 push button (START = S).
sasa
Every time I click on move buttons, I want it to store the button was clicked,
So just when I click the START button, clicked run the commands and send the text (F, T, D, E, F, D) commands to the Arduino by Bluetooth
who knows how to mount these Blocks?
--
I am not sure if I understood you. In case you want to send a command through bluetooth to your Arduino then you have to use the "SendText" Block. Lets assume your Arduino code says if you press the letter "F" in terminal than an LED goes on. Well, all you need is to write the letter "F" in a text and attach it to the SendText Block. Because I am not the best person in describing, I found this video for you :)
I am not sure if I understood you. In case you want to send a command through bluetooth to your Arduino then you have to use the "SendText" Block. Lets assume your Arduino code says if you press the letter "F" in terminal than an LED goes on. Well, all you need is to write the letter "F" in a text and attach it to the SendText Block. Because I am not the best person in describing, I found this video for you :)
--
Concerning the bluetooth I already could communicate with the Arduino,
Concerning the bluetooth I already could communicate with the Arduino,
My doubt is to mount a variable in blocks,
what I need is:
Ex:. variavelLista []
Click Btn Front = var list updates from [] to ["F"]
Right click Btn = var list for updates. . ["F" "R"]
Btn Left Click = var list for updates. . ["F", "R", "L"]
Click Btn Front = var list for updates. . ["F", "R", "G", "F"]
and
When I click on the Btn Start, take the "Variable List" = ["F", "R", "G", "F"] and send it by bluetooth.
I made this way, but is not correct
--
Sorry, as much as i want to help you, i dnt know how. But at least I think I understand your Problem now. I assume you dont want to send the variable like "FRGF". Since its for Arduino, you want to send them separate. In case you can also send it as text "FRGF" than you can use the JOIN block to join the letters together into a label and then send the label.text to Arduino, I dont explain it in detail since I am sure you want to send it separate, don't you?
In your code you have this IF condtion, if "btn.enable". Aren't they already enabled? If not, how can you use them? and I think it should be "if btn.enable = true" etc. However, In your code there is a missing part. seems you want to call your List. Look my picture to know how to finish this part. Then again I was wondering why do you want to call the List if you dont use it at all as we can see in your if conditions.
I would call the list and start from the first Index number of the list. The BluetoothClient1 should send the content of the first index number. I would use a clock to tell the app to send after half a second the content of the second index number etc. You do not need If conditions at all.
Right click Btn = var list for updates. . ["F" "R"]
Btn Left Click = var list for updates. . ["F", "R", "L"]
Click Btn Front = var list for updates. . ["F", "R", "G", "F"]
Btn Left Click = var list for updates. . ["F", "R", "L"]
Click Btn Front = var list for updates. . ["F", "R", "G", "F"]
The simple way is to have four separate lists.
Ex:. variavelLista []
List #1 [] to ["F"]
List#2 ["F" "R"]
List#3 . ["F", "R", "L"]
List#4 ["F", "R", "G", "F"]
List #1 [] to ["F"]
List#2 ["F" "R"]
List#3 . ["F", "R", "L"]
List#4 ["F", "R", "G", "F"]
You are going to have to set the lists to empty,
the set List1 to set List2 to
and select the lists with the four buttons OR use a ListPicker .
This is a suggestion of an easier way to manage your lists...I did not look at your code..but hope this hint may help you.
And, you might be able to do this without using lists at all since these characters do not change so each can be a global variable.
That is part of it. What you are attempting to do is to create a set of programmed commands, and then save them and then use the saved commands to command the robot. You will have to have some mechanism to program a pause between commands ... listing duration of the pause because if you program F R F R probably nothing will happen...you will have to program F pause for so many second then do R and pause etc. Is that true?
--
If anyone needs to use the same programming as below is the way I got it done.
When I click on any command I save the list and click START I send the commands that were clicked by bluetooth.
If anyone needs to use the same programming as below is the way I got it done.
When I click on any command I save the list and click START I send the commands that were clicked by bluetooth.
if you want to delete a list you also can use:
set global lista to create empty list
--
댓글 없음:
댓글 쓰기