Quote:
|
Originally Posted by Erico
If u can make me a favor, can u teach me how to program the joysticks. I will appreciated. thank u
GOOD LUCK THIS YEAR
|
Just to expanded on what DeltaCoder said, the joysticks are refered to by p
X_x and p
X_y, where
X is the port number the joystick is attched to. For example to access the x and y axises of the port one joystick you would use p1_x and p1_y.
The value that comes in on these pins is between 0 and 255 (an
unsigned char). 0 is full to one side, 127 is center, and 255 is full to the other side. For instance, if you have the joystick all the way forward, p1_x would be 255 and p1_y would be 127. If you had it all the way to the right, p1_y would be 127 and p1_y would be 255.
You could also have a combination of the two, of course. For instance, if you where in the forward, right corner, you would get p1_x and p1_y both reading 255.
You can use these values in any way in your program. Just don't try to change their value in code; it won't work!
Hope that helps.

Good luck.