View Single Post
  #6   Spotlight this post!  
Unread 03-02-2015, 09:21
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: Motor Stuttering

I am guessing your code is doing something like this:
Code:
if button 1 pressed
  then run motor forward
  else stop motor
endif

if button 2 pressed
  then run motor backward
  else stop motor
endif
Button 2 will work. However, if you press button 1 the motor will run but will immediately be stopped by the button 2 code.

Instead, try this:
Code:
if button 1 pressed
  then run motor forward
endif

if button 2 pressed
  then run motor backward
endif

if neither button pressed
  then stop motor
endif
You might also want to explicitly deal with both buttons pressed at the same time.