potentiometer programming help

Hey,
We are programming a potentiometer and are having difficulty. We are having difficulty getting our code to work. It was written in Easy C. Can anyone help??

What specific problems are you encountering? Are you not getting readings or can’t you compile your code? You may also want to post the portion of your code that is giving you diffculty. The more specific you are, the more help will you get.

This is the code i made
#include “Main.h”
void OperatorControl ( void )
{
int joy_y_port1;
int joy_x_port2;
unsigned char left_output;
unsigned char right_output;
int limit = 1;
int limit2 = 1;
unsigned int steering;
int pressure;
while ( 1 )
{
PrintToScreen ( "steering value before getting steering reading=%d
" , (long)¬
steering ) ;
joy_y_port1 = GetOIAInput ( 1 , 2 ) ; // get joystick data
left_output = (( joy_y_port1 -127 ) +127) ; // drive motor
SetRelay ( 8 , 1 , -1 ) ; // send power to the compressor
pressure = GetDigitalInput ( 9 ) ; // get air pressure reading
while ( pressure >= 120 )
{
SetRelay ( 8 , 0 , -1 ) ;
break ; // return to driving
}
steering = GetAnalogInput ( 1 ) ; // read pot
joy_x_port2 = GetOIAInput ( 2 , 2 ) ; // get joystick data
if ( joy_x_port2 > 245 || joy_x_port2 < 10 ) // if pushed hard left or right
{
right_output = (( joy_x_port2 - 127 )/2 +127) ; // use joystick over r¬
ide
}
if ( steering >663 ) // correcting towards the left
{
SetPWM ( 3 , 139 ) ;
PrintToScreen ( "this steering value should be above 512=%d
" , (long)¬
steering ) ;
}
if ( steering <= 308 ) // correcting towards the right
{
SetPWM ( 3 , 115 ) ;
PrintToScreen ( "this steering value should be below 512 =%d
" , (long¬
)steering ) ;
}
SetPWM ( 1 , left_output ) ;
SetPWM ( 2 , left_output ) ;
SetPWM ( 3 , right_output ) ;
OIToRelay ( 1 , 1 , 2 , 1 ) ;
}
}

I get readings from the device but it doesn’t work the way i want it to. The purpose it to keep a solo wheel pointed directly outward and when the wheel is turned to the right with the joystick i want the pot sensor to recenter the wheel when we let go of the joystick and vice versa for the right.