Go to Post The spirit of FIRST lives in all of them[us]. Knowledge is power and the unknown is scarey but in the end the spirit of FIRST will endure. - LSevcik [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-01-2002, 17:57
chrisw chrisw is offline
Registered User
#0919
 
Join Date: Jan 2002
Location: Toronto, Canada
Posts: 10
chrisw is an unknown quantity at this point
Send a message via AIM to chrisw
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?
__________________
~ chris ~
  #2   Spotlight this post!  
Unread 25-01-2002, 21:10
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,648
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.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 03:06.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi