VEX Spike
From STEMRobotics
Jump to navigationJump to search
The VEX Spike is a 20 Amp, H-Bridge Relay Module that is small enough to be remotely mounted almost anywhere on your robot. Spike is designed for driving small motors in forward, reverse, or stop (brake). Spike is opto-isolated at the signal input to protect the Robot Controller against motor noise and return currents. Requires a 3-wire cable for connection to the Robot Controller.
,--W \
| R | digital output 1
| B /
/ W----'
to Spike | R----.
\ B--. '--W \
| R | digital output 2
'----B /
W,R,B = White, Red, Black
Code in EasyC
Channel5=Get RxInput (1,5);
Channel6=Get RxInput (1,5);
if (Channel5 == 1) {
// forward
Set Digital Output (1,1);
Set Digital Output (2,0);
} else if (Channel6 == 1) {
// reverse
Set Digital Output (1,0);
Set Digital Output (2,1);
} else {
// stop
Set Digital Output (1,0);
Set Digital Output (2,0);
}//Code in RobotC
Channel5=vexRT[5]; // using the button on the back
if (Channel5 >= 50) {
// forward
SetDigitalOutput[1] = 1;
Set Digital Output (2,0);
} else if (Channel5 <= 200) {
// reverse
Set Digital Output (1,0);
Set Digital Output (2,1);
} else {
// stop
Set Digital Output (1,0);
Set Digital Output (2,0);
}