Please help with some questions~new programmer

We entered the default code. When we do forward, only port 1 y goes to 255, and port x goes up to 130. When we put the joystick on an angle, it goes forward. Same with backward. Can anyone tell me the problem?
For the geartooth sensor, I got the default code. But I cant locate where to write the code for it.
Someone please help.
Thank you

Off the top of my head it sounds like you are using tank drive mode with 2 joysticks. So the left and right motors are controlled by the y axis of 2 joysticks.

What gear tooth code do you have? Where did you get it? In general, the gear tooth sensor is hooked up to a digital input that generates an interrupt and you count the number of teeth passing by with each interrupt. So there are two pieces of the code, one in an interrupt context and another in your user routines that accesses and uses the count. But we need a little more information to be able to help you.

HTH

For your joystick issue, I’m not sure what you mean. Can you describe the problem again in more detail? Tell us which joystick you are using, where it’s connected, when you get the values you’re seeing, how you’re determining what the values are, and what you mean by “on an angle” and “goes forward”.

Code for using the gear tooth sensor isn’t readily available in a “plug and play” form, but it’s easy to change what is available. Grab a copy of Kevin Watson’s encoder code from his web site, follow the directions for installing it into your MPLab project, configure the sensors for digital inputs 1 and 2, and remove the test for the Phase B signal level from the interrupt service routine. You want it always to increment the count when the interrupt occurs.