View Single Post
  #4   Spotlight this post!  
Unread 12-02-2007, 00:01
Shinigami2057 Shinigami2057 is offline
Slackware Is Your New God (Mentor)
AKA: Harry Bock
FRC #1350 (Rambots)
Team Role: Programmer
 
Join Date: Oct 2006
Rookie Year: 2006
Location: Johnston, RI
Posts: 106
Shinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really nice
Re: Limit Switches help

Quote:
Originally Posted by Ianuser View Post
Thanks. How would I program pwm03 to stop when the switch goes on? I'm using a joystick to control pwm03, so when I set it to 127 if the switch is open wont it still not work because during the next loop (26 milisec later) pwm03 is still mapped to p3_y and thers not enough time for the joystick to go back to neutral position. they conflict dont they?
Yes, but you can use the limit switch as a condition to whether or not you will actually map p3_y to pwm03, like so:

Code:
if( rc_dig_in01 == OPEN ) {
    pwm03 = p3_y;
} else { /* The limit switch is closed (tripped), force neutral */
    pwm03 = 127;
}
__________________
One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs.