Log in

View Full Version : Custom Joystick Setup in easyC


Inverted
11-01-2007, 17:27
Last year I developed a "Halo drive" control system for the robot in MPLab, which we plan to use again this year. The only problem is, since this is my senior year, I need to train some younger members to program, which will be done in easyC. Last year I completely avoided easyC because I didn't want to take the time to learn a new program. So this year I'm kinda screwed.

So anyway, I don't have the code I made up last year on me right now, as it's on my other laptop, but I was just wondering if there's any way to set up a control scheme that's not Arcade or Tank drive. If it helps, I had the controllers set up so that the wheels moved forward/back via input from the left joystick Y-axis, and moved left/right via the right joystick X-axis.

Thanks

MattD
11-01-2007, 17:50
Yes, you can use OIToPWM() for direct drive or use GetOIAInput() with SetPWM() and make adjustments.


void OIToPWM(port, axis, pwm, direction)

port - the joystick's port on the OI
pwm - pwm output port number
axis - 1 = x, 2 = y, 3 = wheel, 4 = aux
direction - 0 = normal, 1 = invert

unsigned char GetOIAInput(port, axis)

port - the joystick's port on the OI
axis - 1 = x, 2 = y, 3 = wheel, 4 = aux

void SetPWM(pwm, value)

pwm - pwm output port number
value - the value to set it at

Kingofl337
11-01-2007, 23:12
Check this out: http://www.chiefdelphi.com/forums/attachment.php?attachmentid=4758&d=1165872883

It has examples of exactly what you want to do.