View Full Version : [OCCRA]: Spike Relay and Cortex
We are having problems wiring and programming a spike relay to work with the vex cortex.
How can we program the spike relay to be controlled by a set of buttons to control a keyang motor?
Yes, that is possible.
I took a standard PWM cable, and used a scribe to pull out the red (center) wire from the Cortex end, and put it into another PWM cable shell. I plugged the two of them into a pair of digital ports.
Because I was running some automation on them, the driving state is a typedef enum (with states for hoodFORWARD,hoodREVRSE,and hoodOFF). You don't need to do this, and simply getting a joystick button and setting it to a digital output in code should work. Don't forget to open the IO configuration and set those digital channels as outputs.
While I don't have easyC in front of me (I would have to boot up my windows laptop do use it...), there is a function called joystick-to-digital or something like that which can be used to directly map a joystick button to a digital output. Placing that in your main loop will allow you to control your spike, you will need two buttons (one for each direction).
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.