This is rookie team 2822. We have a flywheel bot with turntable arms. The turntable arms allow us to adjust the angle of the shot. Currently, we have two joystick controls that activate the turntable arms to go up and down. The turntables use a worm and wheel drive for adequate torque. We connected a potentiometer to the wheel of the drive. Can anyone help us with the RobotC programming? We would like joystick controls to activate the worm and wheel to stop at certain potentiometer reading.
Here the pseudocode:
while joystick button is pressed // activate worm motor for the high shot angle
if sensorvalue (potentiometer) between 0 and 1000 // turntable arm moves up
motor = 127
if sensorvalue (potentiometer) between 1002 and 4095 // turntable arm moves down
motor = -127
if sensorvalue (potentometer) is 1001 // turntable arm reaches desired potentiometer reading
motor = 0
Not sure if the pseudocode makes any sense. Basically, we need motor to go forward or go in reverse to reach a certain potentiometer reading. Then, the motor would stop at the correct reading. Eventually, we would have code that adjust the turntable arm at the low post, mid-field and far shot.
Any help with the RobotC code is welcomed!!!