Log in

View Full Version : Pwm and pot


Zoom
29-01-2006, 15:38
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
All you have to do is directly map the pot values to the PWM the servo is on:
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
Actually, you'd have to do something more like:
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
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
thankx alot.

Kevin Watson
29-01-2006, 18:33
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
Actually, you'd have to do something more like:
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.