|
[OCCRA]: Spikes on Cortex
I noticed that someone asked (in the Q&A) how to connect a Spike to the Cortex. Since I cannot reply there, I will help them here (in the general forum):
What I did:
I took a standard PWM cable and cut the red wire. The SPIKE wants a gnd(black), sig(red), sig(white), where the first sig is REVERSE and the second is FORWARD. A Digital channel on the Cortex provides gnd(black), +5v(red), and sig(white). If you don't cut the red wire, then REVERSE will always be on and FORWARD will be determined by the digital output. If you connected a pneumatic valve to that, it would see 0v on the output and +12 on what should be it's ground, and would not work.
If you need two: You can connect the red wire of each valve to the M+ and M- terminals on the SPIKE (the one on m+ will be "forward", the one on m- will be "reverse"), and the blacks to the ground block. Connect the black on the spike to a black on the digital bus, and the red and white on the spike to two digital channels (you would probably have to cut at least 2 PWM cables and solder them together to achieve this, or make your own PWM cable.)
EDIT:
If you want to use the second joystick to control, you have 12 buttons to map to.
(you don't have to do this,this is what I did)
I used an enumerated type to determine mechanism state, and set that based on buttons.
(I had a stack of IF statements, each one set the state as appropriate)
I then had an array of motor speeds and another of piston positions for each state
Since the enum. maps names to integers, you can index the array with the state directly
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor
"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
Last edited by apalrd : 20-10-2010 at 14:39.
Reason: more detail
|