Basic Question

We’re running EasyC pro for our FRC robot and trying to learn the program.

We were wondering, first, what exactly is “auxiliary analog”. It’s the 4th option for an axis when you are manipulating something like OI to PWM. Is there a map for the joystick they give us? What are all the buttons called?

Also, how would I assign a value 0…255 to a button on the actual joystick, for example, the trigger. Lets say I wanted the trigger to make the motor attached to PWM number 1 run at 200 when it’s pressed. How is that done?

Thanks a lot,

1182

if (trigger == CLOSED)
     pwmXX = 200;
else
     pwmXX = 127;

Thanks Tom. We understand the logic behind it but we don’t actually know how to implement the trigger in easyC. If you could give us a dumbed down version that would be great.

if (trigger == CLOSED)
pwmXX = 200;
else
pwmXX = 127;

^^ What function block (those things at the left of the screen that you drag in), i.e. “OI to PWM” lets me do that. We know what you mean in logic but what type of variables should “trigger” be set to.

Our problem is our lack of experience with EasyC, not with the logic. We just don’t know how to implement it into EasyC Pro.

Thanks a lot

In order to set a value to 200 to a motor in port 1 when a button is pressed, You need to do the following: do a while loop that never ends:

 while(1)

Now, from the RC_Control functions drag and drop Digital OI Input function and in port enter the port of your joystick, in button return the button you want (let’s say 1), and in retrieve into a local variable you made before that (let’s call it buttonStatus (initialize it to be 0)). Now, do a while(1) loop. In the loop check: while(buttonStatus!=0) then do the following: drag the SetPWM from the output functions. Enter port 1, speed 200. Then, in the same inner loop, enter the Digital OI Input function in order to know if the button was released.
Now it should work:)
*could be that buttonStatus needs to be equal to 1 at the beginning and the while condition to !=1.

There is another, more better way to do it:
Do a while(1) loop, in it put the OI to PWM function from the RC_Control function blocks, and in the joystick port enter the joystick port, in the axis put the y axis (number 2) and in the PWM# put 1 (the PWM port). Now you can use your motor with the analog joystick (the motor has to be connected to a victor in order to set different speeds).
Hope I helped you:)

Thanks a lot to both of you. It worked.

Peace

Wompas