Hello, we need some help with programming in Modkit and looking for your help. We have 2 wheels that are need to spin, powered by 2 separate motors and would like to make a program that:
- When you press and release button (E) (up) on controller: they both start spinning and both keep spinning
- When you press and release button (E) (up) again: they both stop
Thanks for your help,
Have you tried creating a variable? For example, create a variable, we’ll call it “button.”
This variable can be used in a forever loop within the controller’s code such that if “button” =0, pressing button E on the controller will change it to 1, else if “button” = 1, pressing E will change it back to 0.
At the end of this if/else loop, place a brief wait (.05) to prevent accidental double-pressing of the button in a single loop (debouncing).
Finally, put both motors in a forever loop so that if “button” = 1, the motors spin, else, if “button” = 0, they stop.
Give it a try. It will likely make more sense to build the code than to read this.
Post again if you have problems, and I can write it out in Modkit and add screenshots. The code is actually very short / simple.
Is there any reason for “2. When you press and release button (E) (up) again: they both stop”? Most kids might be used to press up to start and down to stop … E up and E down. There are enough buttons to use right?
but via search…
Starting with visual in this thread (http://www.vexiqforum.com/forum/main…urce-or-how-to), can add blocks as needed…
Also here “Can we program one button to control 2 motors at the same time?”
by @Art “Attached are screenshots of simple programs from ROBOTC Graphical and Modkit for VEX that show how to drive 2 motors off of one Controller button channel.”
When you find answers it is possible the answer posted might have been for different version of modkit as you may notice… Functionality should be the same though. Then what you are asking might require some advanced steps. It allows but start with basics and move on up? Better user experience.