I need help on a vex code

i am new to programing vex controllers on easy c all i have done is ifi controllers. I need to have one of the buttons on the back of the controller( i’m not really sure what channel they call them) when it is are press to turn X motor at a pwm signal of 170 for 2 seconds. Can anyone help me

The buttons on the back of the controller are channels 5 and 6 (channels 1-4 are the joysticks). The on robot Vex controller basically sees 6 PWM inputs from the operator R/C controller. Normally, channels 5 and 6 have the value 127. Pressing the top button gives a value of 255 and pressing the bottom button sends 0.

I don’t know about EasyC but in the regular C Vex programs, channel 5 has a #define of PWM_in5 and channel 6 of PWM_in6. (Or you could use the raw declarations in the rxdata structure, rxdata.oi_analog05 and rxdata.oi_analog06.) The sample code has defines for BUTTON_FWD_THRESH as 154 and BUTTON_REV_THRESH as 100 to give some leeway in testing whether the buttons have been pressed which seems to imply the values of 0 and 255 might not be firm but the little testing I’ve done that’s what I got.

Once you determine the button has been pressed, handle it just like one of the joystick buttons on the FRC operator interface. Just remember the basic control loop on the Vex executes at 18.5 milliseconds rather then the FRC rate of 26.2 milliseconds.

A just wrote this in EsayC pro. It assigns motor 1 a value of 255 for 2000ms, and then assigns motor 1 a value of 127.

I haven’t tested it since I don’t have a Vex hear me, but it should work.

You should be able to modify the code to work with multiple motors/switchs.

The EasyC pro files are attached.

EDIT: If you have any questions PM or e-mail me.

Botton Prog.zip (1.83 KB)

Botton Prog.zip (1.83 KB)