|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
pot help
i'm trying to use a pot to limit a motor to turning only 90 drgrees. I need to know what the value that is stored in the sensor variable represents and how to prevent the motor from turning ( the motor will likely be run through a victor). also, is their a way that i can have the program slow down the motor as it approaches the end of a 90 degree turn?
|
|
#2
|
||||||
|
||||||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| R/C Control types | Andy Brockway | Programming | 43 | 24-11-2003 17:07 |
| Pwm | VanWEric | Programming | 17 | 01-11-2002 16:07 |
| 100k Slide Pot | archiver | 2001 | 4 | 24-06-2002 02:53 |
| Picker Or Pickee | archiver | 2000 | 54 | 23-06-2002 22:26 |
| More pBasic Woes... | Dan 550 | Programming | 4 | 11-11-2001 23:08 |