View Single Post
  #3   Spotlight this post!  
Unread 18-02-2005, 22:06
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Problems programming a switch

Connect the common of the switch to ground on the OI, the "up" contact to p4_sw_aux1, and the "down" contact to p4_sw_aux2. Assuming the arm motor is on pwm3, your code would look like this:
Code:
    if (p4_sw_aux1 == 1)
      pwm3 = 254;
    else if (p4_sw_aux2 == 1)
      pwm3 = 0;
    else
      pwm3 = 127;