View Single Post
  #1   Spotlight this post!  
Unread 23-06-2002, 23:38
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
help to rookie teams

Posted by Stephen at 1/25/2001 1:57 PM EST


Other on team #122, NASA Knights, from Grafton High School (Robotics team is at NHGS) and NASA.



This post is meant as a programming tip for rookie teams. For the past few years (well, this is what I've been told, this is actually my first year at FIRST) my team has used a button on the robot to reverse the controls; in escence switching the motors you send the certain joystick controls to. This helps to stop the disorientation you get when the robot is turned around and you have to mentally swap everything around. Well, now to the point: as you now, you are only permited 26 varibles in pbasic, and most teams (even mine last year) use a temp variable to swap:
- temp = a
- a = b
- b = temp
but, this wastes a varible. Here is very simple way to swap the varible using bitwise operations:
- a = a ^ b
- b = a ^ b
- a = a ^ b
If you want help understanding the logic, or have problems implementing this code - send me an e-mail at Steven3554@yahoo.com


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.