Pwm-servo help
·Ok, since I do not have any idea why the PSC is not responding with the test program. I would like to test my motors with the PWM.·Does this·PWM avoid the use of PSC?
I see that there is a test program that can cotrol motors with the PWM Object in the javelin manual. I want to test it out, but the manual does not tell me how to wire it.· However, the code has static PWM servo = PWM (CPU.pin12,173,2304). So I am assuming that I can use pin12 for the·serial line.·
Am I correct?·
Thanks
I see that there is a test program that can cotrol motors with the PWM Object in the javelin manual. I want to test it out, but the manual does not tell me how to wire it.· However, the code has static PWM servo = PWM (CPU.pin12,173,2304). So I am assuming that I can use pin12 for the·serial line.·
Am I correct?·
Thanks
Comments
I don't understand how this PWM Object works.
For example, PWM (CPU.pin12,173,2304) How do the parameters 173 and 2304 tell the servo to go to center position?
Thanks
http://forums.parallax.com/showthread.php?p=543863
http://forums.parallax.com/showthread.php?p=542555
http://forums.parallax.com/showthread.php?p=537225
regards peter
The 2304 doesn't really matter, it's just the down time between pulses. It serves as the "refresh rate" of the servo positions. I believe 2304 is the value for a 20ms delay between pulses. At that rate, it is still updating the servo's positions 50 times a second. I've tried halving the value to get higher torque from my servos, but they end up just jittering really quickly and heating up also. IMO, just leave 2304 alone.
Here is a program I used to use to find the PWM values that gave certain positions of my servos. For example, I had an arm on my robot, and I used this program to find the optimal PWM values that constituted its open/closed positions.
This was when I ran servos directly off of the javelin's pins. This is NOT a good idea, but if you can't get the PSC to work, this is a good place to start. I say this is not a good idea because it really is a waste of the javelin's capabilities. Also, you can only run 6 servos max (6 virtual peripherals is the max). Also, you have to write your own ramping functions. If you want servo to go from PWM value 100 to PWM value 200, if you simply say myPWM.update(200,2304), your servo will jerk to its new position instantly. That is bad for the servo and your hardware. You should use a for loop with CPU.delay(20) in the loop to slowly ramp the servo to its position. With the PSC, however, you just send one command that includes a "ramp rate." The PSC does all the ramping for you. When your project gets more complicated, you will really see the merits of using the PSC to control servos.