Hey I programmed joystick triggers to make a motor go back and forth using:
if (p1_sw_trig == 1)
{
pwm06 = 0;
}
if(p2_sw_trig == 1)
{
pwm06 = 254;
}
if((p1_sw_trig == 0) && (p2_sw_trig == 0))
{
pwm06 = 127;
}
Now it worked flawlessly… but then we soldered our three point switches in. On our port 3 serial, we have pins 9 as forward position, 15 as backward postition, and the middle position is grounded on pin 12. On our port 4 switch, we have forward as pin 5, backward as pin 8, and middle grounded with pin 12… or 4… they are both grounds… not sure which one though. Anyway…
pins 9 and 15 are names p3_sw_aux1 and p3_sw_aux2 correct? And pins 5 and 8 are called p4_sw_trig and p4_sw_top, correct?
So we replaced the code with this:
if (p3_sw_aux1 == 1)
{
pwm06 = 0;
}
if(p3_sw_aux2 == 1)
{
pwm06 = 254;
}
if((p3_sw_aux1 == 0) && (p3_sw_aux2 == 0))
{
pwm06 = 127;
}
and …
if (p4_sw_trig == 1)
{
pwm07 = 0;
}
if(p4_sw_top == 1)
{
pwm07 = 254;
}
if((p4_sw_trig == 0) && (p4_sw_top == 0))
{
pwm07 = 127;
}
The problem is… it does not move at all when we start it up. I’ve been messing around with this code for a while now and can’t get the motors spinning. I know for sure the Victor is wired correctly because I put in the code:
pwm07 = 0;
and it spun fine. Is the code correct still? Or did we wire it wrong? Is the ground not wired correctly? Any suggestions are helpful. This is pretty much our last day to work on this soooo anything would help.
Thanks in Advance,
Idaman323