View Single Post
  #5   Spotlight this post!  
Unread 06-02-2007, 14:27
Ultima Ultima is offline
Registered User
FRC #0369
 
Join Date: Oct 2005
Location: Brooklyn, NY
Posts: 26
Ultima will become famous soon enough
Re: OI Input Autonomous

I have a few questions. Well first of all I edited the code and this is what it looks like now as I try to compile:

Quote:
void auton_select(void)
{
static char last_sw1;
static char last_sw2;

if(p1_sw_trig == 1 && p1_sw_trig != last_sw1)
{
if(auton_select < 2)
{
auton_select++;
}
else
{
auton_select=99;
}
}
if(p1_sw_top == 1 && p1_sw_top != last_sw2 && auton_select > 0)
{
if (auton_select == 94)
{
auton_select= 2 ;
}
else
{
auton_select--;
}
}
last_sw1 = p1_sw_trig; //oneshot the trigger and top buttons
last_sw2 = p1_sw_top;

User_Mode_Byte = auton_select;
}
Second of all, how would I got about declaring auton_select as a global variable, and third I would need to get around the following errors:

Quote:
C:\2007 arm code\FrcCode2005v2.4\user_routines.c:661:Error [1128] compatible scalar operands required for comparison
C:\2007 arm code\FrcCode2005v2.4\user_routines.c:663:Error [1147] scalar type expected for increment operator
C:\2007 arm code\FrcCode2005v2.4\user_routines.c:667:Error [1131] type mismatch in assignment
C:\2007 arm code\FrcCode2005v2.4\user_routines.c:670:Error [1128] compatible scalar operands required for comparison
C:\2007 arm code\FrcCode2005v2.4\user_routines.c:672:Error [1128] compatible scalar operands required for comparison
C:\2007 arm code\FrcCode2005v2.4\user_routines.c:674:Error [1131] type mismatch in assignment
C:\2007 arm code\FrcCode2005v2.4\user_routines.c:678:Error [1148] scalar type expected for decrement operator
C:\2007 arm code\FrcCode2005v2.4\user_routines.c:684:Error [1105] symbol 'User_Mode_Byte' has not been defined
C:\2007 arm code\FrcCode2005v2.4\user_routines.c:684:Error [1101] lvalue required
The code is from 2005 since we are just testing our prototype arm with the 2005 controller.