View Single Post
  #20   Spotlight this post!  
Unread 01-05-2008, 16:52
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

if (rc_dig_in06 == 1)
{
pwm01 = ((long) Get_Analog_Value(rc_ana_in01) * (127 / 1023) + 127);
}
if (rc_dig_in06 == 0)
{
pwm01 = ((long) Get_Analog_Value(rc_ana_in01) * (- 127 / 1023) + 127);
}

Tada! I think this is right, ill have to give it a try when I get home...