Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Pwm and pot (http://www.chiefdelphi.com/forums/showthread.php?t=42903)

Zoom 29-01-2006 15:38

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?

Ryan M. 29-01-2006 15:44

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.

steven114 29-01-2006 15:49

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.

Biff 29-01-2006 16:04

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.

Zoom 29-01-2006 16:13

Re: Pwm and pot
 
thankx alot.

Kevin Watson 29-01-2006 18:33

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

Ryan M. 29-01-2006 18:47

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.


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

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