View Single Post
  #2   Spotlight this post!  
Unread 17-02-2008, 13:47
RyanW RyanW is offline
Registered User
FRC #0449 (Blair Robot Project)
Team Role: Programmer
 
Join Date: Feb 2007
Rookie Year: 2007
Location: MD
Posts: 40
RyanW has a spectacular aura aboutRyanW has a spectacular aura about
Re: IR button coding rules

Well, first of all, pwm03 is going to be 127 no matter what counter1 is. You set it to 200, and then immediately to 127 in the same method. It's either going to stall back and forth for 15 loops (if you're using something like WPILIB which calls GetData and PutData in the middle of your routines) or else just stay at 127.

Beyond that,
If you're using rc_dig_in08 to 11 as your IR buttons, this isn't legal. Any individual IR command should only make reference to one of the buttons, UNLESS you use combinations of buttons to minimize interference, and still send EXACTLY four commands. So you need to move if(rc_dig_in09==1&&rc_dig_in10==1) out of your else if.

You're allowed to use timers in your command - you're allowed to use pretty much whatever you want in your command - BUT it has to be internal to the command, or else directly based on sensor inputs from the robot. So if you tell it "Drive straight", and it sees that there's a wall, it can stop based on that information. Your counters are fine as long as they're initialized in the same IR command.