I am beginner in vex programming, I need help. Could someone help me how to program in vexcode (graphical) the robot to use with the left stick to control the speed and the right stick to steer, please?
Motor are in 1 and 6 port. My robot have two bumper switch to stop (front and back)
Thank you very much
If you just want to drive the robot around with the joysticks, you can do that in the device configuration menu without writing any code yourself. Configure a drivetrain with the right ports, then add a controller and click/tap the joysticks until they indicate the control scheme you want.
Thank you! it work!
Now, i dont know how can i move the arm with L button. my arm have two motors, i wish move both motors with the L button (controller). How can i configure vexcode iq (two motors with the same button) and programming it?
I don’t think the configuration menu supports assigning multiple motors to a single button, but it’s easy enough to write some code that does that.
The idea is to have a loop that constantly checks whether either of the left shoulder buttons are being pressed, and spins the motors in the right direction or stops them as appropriate. Something like this:
You’ll need to replace the comment blocks with the right blocks to spin and stop your motors as appropriate.
The “wait 0.1 seconds” block is very important, if you don’t include that block your program will likely be stopped by the brain due to using too much CPU time.
What type of programming software do you use? If you use VexCode IQ, then you can do something like this:
Instead of setting my motors to a button on the controller map, I just have them set as motors. Then, what I can do is make it so when each controller button is pressed, it spins both motors.
The code should look something like this, where:
When Controller button (E Up) (pressed):
spin (motor1) (Forward)
spin (motor2) (Forward)
When Controller button (E Down) (pressed):
spin (motor1) (Reverse)
spin (motor2) (reverse)
You might have to reverse 1 of your motors by swapping it’s forward and reverse if they are fighting each other, and going in different directions.