Thread: pot help
View Single Post
  #2   Spotlight this post!  
Unread 25-01-2002, 21:10
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is online now
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,644
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Brute force...

one way to do it is just to turn your motors off at 90 degrees and to limit them to a lower amount at some lesser amount.

Try the following (as always, off the top of my head, untested but probably not too far from correct)

' assume right joystick movement turns motor right, left turns it left.
' assume steering motor is wired such that PWM1 > 127 moves steering left
' assume pot is wired such that Sensor1 >127 means steering is pointed left
' assume pot is adjusted such that Sensor1 = 127 means straight
'assume you enter the code below with p1_x as your variable that holds the joystick value that you what to use to steer
'assume that the output statement uses p1_x as the output to PWM1

Sensor1FullLeft CON 127 + 100 ' approx value, yours may vary
Sensor1SlowRight CON 127 + 50
Sensor1SlowLeft CON 127 - 50
Sensor1FullRight CON 127 - 100
PWMSlowRight CON 127 - 50 ' adjust to suit
PWMSlowLeft CON 127 + 50 ' adjust to suit

.
.
.
If sensor1 < Sensor1FullRight StopSteerMotor
If sensor1 < Sensor1SlowRight SlowRightSteerMotor
If sensor1 > Sensor1FullLeft StopSteerMotor
If sensor1 > Sensor1SlowRight SlowLeftSteerMotor

Goto DoneSteerMotor
StopSteerMotor:
p1_x = 127
Goto DoneSteerMotor

SlowRightSteerMotor:
p1_x = PWMSlowRight
Goto DoneSteerMotor

SlowLeftSteerMotor:
p1_x = PWMSlowleft
Goto DoneSteerMotor

DoneSteerMotor:
.
.
.

Hope this helps.

If I get a chance, I will post a better way later.

Joe J.