Trying to control 1 motor with 2 buttons

I’ve passed couple of hours trying to make one globe motor work with joystick buttons:(

I want that #2 makes the motor spin right and the #4 makes the motor spin left.

I open a Get from joystick and I set the buttons I plan to use. Then I open a loop where false is empty but in True I add an open Motor and I can’t seem to find the way to connect them all together… And to specify where to should each one should spin…

If anyone can explain me or show me a small SS I would really appreciate it:)

you need to open the motor outside of teleop. once the motor is open, you set it inside the case structure.

I posted a picture of some code that will do this for you that is simpler than using a case structure. It uses some logic gates in the code and ensures that the relay is set only once during each loop execution. If you are controlling jaguars or victors than you can just change the set relay to set speed and submit constants (255, 127, or 0 or any degree thereof) to the true/false cases for the select blocks.

Here is the thread.

feel free to post if you have any more questions! Hope this helps!

Problem is that the I can’t find the way to wire the joystick buttons to that motor…
I couldn’t understand the relay thing either…

are you trying to control a relay or a jaguar/victor?

Specifically a Jaguar :smiley:

sure okay. To do this I would use code similar to what i posted in the picture and instead of assigning forward/ reverse/off to the block selectors use integer values. 255 would be full power in one direction, 0 would be full power in the other direction and 127 would be off. Also, instead of using the set relay use the set speed to connect to the output of the block selector.

It might be easier to just use a relay instead of a jaguar unless you really need to control speed.

What is a relay?
I’m a rookie and I don’t know some stuff…

sorry about that. they are also known as the spikes. They cannot be used to power the CIMs (against the rules), but they can be used to power smaller motors like the globe motors. On the spike there is M+ and M- on one side. On the other side there is 12V and GND. The M+ and M- is for the motor leads. the 12V and Gnd is for power to the motor. there is also a three terminal header in the spike. it is rectangular and a pwm cable plugs into that which delivers the signal from the digital I/O sidecar to the spike.

The relay is pretty much just an on/off or forward/off/reverse device. There is no speed control. Determining if you need speed control depends on the application for the motor.

In the WPI libraries there are VIs written for controlling the spike. I think they are under WPI Library–>Actuators–>Relay. By putting those VIs into the code and then clicking the question mark in the right hand corner and hovering over the icon you will get a description of what he inputs and outputs are to the vi.

Here is also more info from NI.

hope this helps!

Oh the Spikes! Oh Lala!
I’ll use those then! I’ll check tomorrow and let you know.

Thanks :smiley: