View Single Post
  #3   Spotlight this post!  
Unread 03-03-2009, 22:58
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
Re: team update #9 "Autonomous - Disabled" - what?

Our robot has a six position switch on a DriverStation analog input, configured to read out 0V, 1V, 2V, 3V, 4V or 5V. I think this will work, can't test it until the regional:

Code:
static int auto_v = 0;
static int autonomousmode = 0;

void DisabledPeriodic(void) {
int auto_v_now;

  auto_v_now = ((int)((m_ds->GetAnalogIn(1))+0.5)) + 1;
  if(auto_v_now == auto_v)
  {
    autonomousmode = auto_v;  // only shift when equal (stable voltage)
  }
  auto_v = auto_v_now;  // always update current state
}
I know that GetAnalogIn() does not return a "float" voltage like GetVoltage() does, so auto_v_now will need scaling. The robot will use autonomousmode to select one of six modes during the autonomous period.
Reply With Quote