Programming the Spark Motor Controller C++

I have included the Spark.h header file and I have an if statement on line 168.
When the robot is powered on and enabled the light changes from blinking blue to solid blue but there is no output on the motor side.

Here is the code

See page 4 of the Spark manual.

Solid blue means it’s getting a signal but is in neutral, so the motor should not be going.

Yes I meant, that I know it is getting a signal but I can’t get it to go forward or backward.

Are you pushing the button corresponding to rawButton4?
Is the talon plugged into port 0?

If you think you are and it is, put in some code next to those two set commands (inside the if-then) to send feedback to the driver station (just turning a light red/yellow/green should be enough). This will tell you if you are actually executing that bit of code or not.

If you are executing that code, check your cable and/or try replacing the spark with another one or a talonSR or VictorSP (all close enough to each other for this test).

If you are not executing that code when you push the button, check for a problem on the joystick side. (wrong button, broken wire, etc.) or continue looking for a software problem.

The spark is plugged into pwm 0

I will try hooking a talon sr up instead, if that doesn’t work I’ll try adding feedback in the DS.

Also the joystick is fine I have checked it in JoyTester and in the DS, all buttons and sticks work.

Thanks.

Try changing your else condition to run the motor in reverse instead of stopped - then you’ll have positive indication that things are hooked up and talking. Then it’ll be narrowed down to a button issue.

if(driveStick->GetRawButton(4)) 
{ 
	spark1->Set(1); 
} 
else 
{ 
	spark1->Set(-1); 
}