Go to Post A very important thing that I learned is how to think, not what to think. - Anna B. [more]
Home
Go Back   Chief Delphi > Technical > Programming
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 29-01-2006, 15:38
Zoom's Avatar
Zoom Zoom is offline
Lost User
AKA: Umair Nasir
FRC #0369 (Nuts & Volts)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2003
Location: Brooklyn
Posts: 22
Zoom is an unknown quantity at this point
Send a message via MSN to Zoom
Pwm and pot

i want to know if there is a way in which i can make the servos move (which are hooked in to pwm) when i trun the pot. i get the value for the pot. now i need to get the value for the servo and some how make it move when the value of the pot changes. is there a way?
__________________
A Program isnt finished until the Programmer dies...
  #2   Spotlight this post!  
Unread 29-01-2006, 15:44
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Pwm and pot

All you have to do is directly map the pot values to the PWM the servo is on:
Code:
pwm01 = rc_ana_in01;
Change the ports to what you are actually using.

If you need more complicated control... make it more complicated yourself.

--EDIT--
See below message.
__________________


Last edited by Ryan M. : 29-01-2006 at 18:46.
  #3   Spotlight this post!  
Unread 29-01-2006, 15:49
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: Pwm and pot

Actually, you'd have to do something more like:
Code:
pwm01 = Get_Analog_Value(rc_ana_in01) >> 2;
The controller doesn't sample the analog inputs until you call Get_Analog_Value, and the shift is to convert the 10-bit analog input to the 8-bit PWM output.
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #4   Spotlight this post!  
Unread 29-01-2006, 16:04
Biff Biff is offline
Registered User
AKA: Tom Cooper
#1227 (Techno Gremlins)
Team Role: Mentor
 
Join Date: Jan 2004
Location: Grand Rapids MI
Posts: 214
Biff is a jewel in the roughBiff is a jewel in the roughBiff is a jewel in the roughBiff is a jewel in the rough
Re: Pwm and pot

Both the above should work, The first is if the pot is connected to the OI (operator control) the second is if the pot is on the robot. Just fill in the correct context and you are good to go.
  #5   Spotlight this post!  
Unread 29-01-2006, 16:13
Zoom's Avatar
Zoom Zoom is offline
Lost User
AKA: Umair Nasir
FRC #0369 (Nuts & Volts)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2003
Location: Brooklyn
Posts: 22
Zoom is an unknown quantity at this point
Send a message via MSN to Zoom
Re: Pwm and pot

thankx alot.
__________________
A Program isnt finished until the Programmer dies...
  #6   Spotlight this post!  
Unread 29-01-2006, 18:33
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Pwm and pot

Quote:
Originally Posted by Zoom
i want to know if there is a way in which i can make the servos move (which are hooked in to pwm) when i trun the pot. i get the value for the pot. now i need to get the value for the servo and some how make it move when the value of the pot changes. is there a way?
Danny Diaz over in the National Instruments forum wrote a LabVIEW app that allows you to move motors around in realtime. You might want to check it out.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #7   Spotlight this post!  
Unread 29-01-2006, 18:47
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Pwm and pot

Quote:
Originally Posted by steven114
Actually, you'd have to do something more like:
Code:
pwm01 = Get_Analog_Value(rc_ana_in01) >> 2;
The controller doesn't sample the analog inputs until you call Get_Analog_Value, and the shift is to convert the 10-bit analog input to the 8-bit PWM output.
Yep... my mistake.
__________________

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
reading hobby PWM sciguy125 Programming 2 17-10-2005 20:47
R/C Control types Andy Brockway Programming 43 24-11-2003 17:07
How do you set a speed limit on the servo Fares Programming 6 01-01-2003 15:04
Pwm VanWEric Programming 17 01-11-2002 16:07
More pBasic Woes... Dan 550 Programming 4 11-11-2001 23:08


All times are GMT -5. The time now is 16:09.

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