View Single Post
  #8   Spotlight this post!  
Unread 03-02-2008, 20:46
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,112
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: Programing joystick buttons

Quote:
Originally Posted by lukevanoort View Post
I'm surprised it takes that much. In MPLAB, it is just four:
Code:
if(p1_sw_top)
   pwm01 = 254;
else
   pwm01 = 127;
or five:

Code:
if(p1_sw_top){
   pwm01 = 254;
} else {
   pwm01 = 127;
}
depending on your coding styles.
I can name that tune in one note...I mean, I can write that function in one line:
Code:
  pwm01 = p1_sw_top?254:127;
Anyway, Shivang, if you give some more detail about what you want to accomplish, we can give better advice. Which buttons do you want to use, and what do you want the motors to do when you use them?