Pintype cannot be resolved to a variable

public Spark intake = new Spark( getChannelFromPin( PinType.PWM, 9 ));

hi when i try to define the connection of the spark to the navx it says on the “Pintype”

“Pintype cannot be resolved to a variable”

can someone explain to me what i did wrong thanks

You don’t need to do the whole getChannelFromPin( PinType.PWM, 9 ). The constructor only requires you to input the number corresponding to which PWM port your Spark is plugged in, so in this case, you would only just put Spark intake = new Spark(9);

1 Like

This is not correct. @fr3sh is asking how to access a Spark on the NavX (MXP). new Spark(9) uses port 9 on the roboRIO. PWM 9 on the NavX should be referenced as PWM 19 per

@fr3sh The NavX ExpansionIO example defines PinType and the function getChannelFromPin. If you want to use those in your own code, you can copy them into your project. Or you can just manually look up the right port from that page.


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.