View Single Post
  #19   Spotlight this post!  
Unread 01-05-2008, 14:13
Generalx5's Avatar
Generalx5 Generalx5 is offline
Hard Core Inventor
AKA: Jun(John) Zheng
FRC #1346 (Trobotics)
Team Role: Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: CANADA
Posts: 94
Generalx5 will become famous soon enough
Re: Need help with PWM 1-2ms pulse control

Haha, wow! You make it sound so simple. Heres my attempt....

I've been able to keep set B as Pwm=127 when pot is close to 0, and Pwm=255 when pot is close to 1023.

As for set A, I did the plus 127 method. Pwm= ((analog signal) * -127 / 1023) + 127

so that gets me close to Pwm= 0 when the pot goes to 1023.
close to Pwm=127 when pot goes to 0.


This way, I've made the ratio a negative number, when I enter 1023 for the analog signal, the pwm will result in -127, so by adding 127 at the end, I will obtain 0 when the Pot is at 1023 or close to it. When the pot is close to 0, 0*(-127/1023) = -127 + 127, I get a 0 for the PWM.

So this actually works out to this situation:

Pot @ 1024 SetA Pwm= 0 SetB Pwm= 255
Pot @ 0 SetA Pwm=127 SetB Pwm=127

Il have to play with the numbers some more to give it a neutral band in the middle. This is all theory, but I've havnt tested it on my mini rc yet, so when I get back, ill' give it a try.

Last edited by Generalx5 : 01-05-2008 at 14:22. Reason: no one is perfect, I just had to hit the post botton before I re-read.