My team has recently asked me to program a few different functions onto one button to be used during driver control. I am still fairly new at Vex Coding Studio, I’m just looking for someone who can explain the process to me, I have an example code I can post if people want to see it.
Can you provide more detail on what you need? Do you need one button to perform several different actions, or do you need that one button to initiate a series of actions (a macro)?
I’m not quite sure what you’re asking for.
(VCS has been discontinued, I’d suggest moving to vexcode)
You just need an if statement and then all of the functions can be listed inside.
It would likely look like this:
If (controller.button.pressing()){
function1();
function2();
}
I’m looking for one button to perform a series of functions.
I’m still confused, what exactly do your teammates want you to do?
Like what exactly is the series of functions?
Are you trying to preform a few action one after the other when you press a button? So like one button press would: move the lift then open the claw then close the claw after 1 second.
Or are you trying to move multiple motor when the button is pressed or something similar?
If you could provide the specific thing you are trying to implement it would a lot easier to answer.
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(Vex Coding Studio has been discontinued, I’d suggest moving to Vexcode)
(The text is small so that no one is annoyed since this has been already said.)(The only downside with Vexcode is you cannot use actual tab and set them to size 4.)(If you are using /raw that is cheating because it has to get smaller every time.)
Ill give you two answers.
-
If you want it to perform a series of functions, ie. when you press button x, drive forward then turn right, just simply list them in the if statement in the order you want them done, like how you would in auton. Also im assuming you would want it to be a macro (one-tap) so put it in a while loop inside the if statement.
-
If you want it to perform multiple seperate individual functions, then you will have to do one of two things. You can have it so that if you hold something down it will do one thing and if you tap it it will do another, or you can use a “shift key”. I, personally, dont know how to code one of them yet since ive had no use, but i know @Zach_929U knows how to so if you want to do that i wouldnt doubt hed help out with that.
From what ive read i think you wanted to do the first thing, simply just code a series of functions like you would in autonomous then put that on a button
To do the shift key I’m pretty sure you would just need to have an and in the if statement.
So it would look like this:
If (controller.button.pressing() && controller.button1.pressing()){}
It’s been a month and they haven’t asked any more questions…
I think they have probably solved the problem.
Oops, was browsing the forum to find helpful topics and didn’t even look at when stuff was posted.