Esempio n. 1
0
void lcdMainMenu(){// code for main menu in the lcd
  if (lcdReadButtons(uart1) == LCD_BTN_LEFT && previousLCD != LCD_BTN_LEFT && arbitraryVariable == 0){// if clicked now, and not clicked 20 ms before
    menuCount--;
  }
  else if (lcdReadButtons(uart1) == LCD_BTN_RIGHT && previousLCD != LCD_BTN_RIGHT && arbitraryVariable == 0){
    menuCount++;
  }
  if (menuCount < 0){
    menuCount = maxNumberMenus;
  }
  else if (menuCount > maxNumberMenus){
    menuCount = 0;
  }
  // Main Menu
  switch(menuCount){
    case 0:
      lcdClear(uart1);
      lcdSetText(uart1, 1, "750R's LCD");
      lcdSetText(uart1, 2 , "Welcome");
      subMenuCount = 0;
      break;
    case 1:
      lcdClear(uart1);
      lcdSetText(uart1, 1 , "Autonomous");
      subMenuCount = 1;
      break;
    case 2:
      lcdClear(uart1);
      lcdSetText(uart1, 1 , "Battery");
      subMenuCount = 2;
      break;
    case 3:
      lcdClear(uart1);
      lcdSetText(uart1, 1 , "Sensors");
      subMenuCount = 3;
      break;
    case 4:
      lcdClear(uart1);
      lcdSetText(uart1, 1 , "Motors");
      subMenuCount = 4;
      break;
    case 5:
      lcdClear(uart1);
      lcdSetText(uart1, 1, "Auton Recorder");
      subMenuCount = 5;
  }
}
Esempio n. 2
0
void calibrate(){

	if (bot == calib){
		wind(joystickGetAnalog(1, 3));

		if (joystickGetDigital(1, 7, JOY_RIGHT)){
			encoderReset(encode);
		}
	}

	int oldval = leftdraw;

	//raise the left shooting value
	while (joystickGetDigital(1, 7, JOY_UP)){
		leftdraw = oldval - 5;
		delay(25);
	}

	//lower left shooting value
	while (joystickGetDigital(1, 7, JOY_DOWN)){
		leftdraw = oldval + 5;
		delay(25);
	}

	oldval = rightdraw;

	//raise right shooting value
	while (joystickGetDigital(1, 8, JOY_UP)){
		rightdraw = oldval + 5;
		delay(25);
	}

	//lower left shooting value
	while (joystickGetDigital(1, 8, JOY_DOWN)){
		rightdraw = oldval - 5;
		delay(25);
	}

	char buf[16];
	sprintf(buf, "R: %d L: %d", rightdraw, leftdraw);
	lcdSetText(uart1, 2, buf);


}
Esempio n. 3
0
void display(char* disp){
	if (current == driver){
		if (announce != NULL && millis() - lastannounce <= 3000){
			lcdSetText(uart1, 1, announce);
		}

		else {
			if (bot == calib){
				char buf[16];
				sprintf(buf, "Calibrate: %d", encoderGet(encode));
				lcdSetText(uart1, 1, buf);
			} else if (bot == lift){
				if (drinv == 1){
					lcdSetText(uart1, 1, "Up");
				} else {
					lcdSetText(uart1, 1, "Down");
				}
			} else if (bot == shoot){
				if (shootdir == left){
					char buf[16];
					sprintf(buf, "Left: %d", encoderGet(encode));
					lcdSetText(uart1, 1, buf);
				} else {
					char buf[16];
					sprintf(buf, "Right: %d", encoderGet(encode));
					lcdSetText(uart1, 1, buf);
				}
			} else if (bot == control){
				char buf[16];
				sprintf(buf, "Encoder: %d", encoderGet(encode));
				lcdSetText(uart1, 1, buf);
			}
		}
	}

	else {
		lcdSetText(uart1, 1, disp);
	}
}
Esempio n. 4
0
double getRedEncoderVelocity(RedEncoder encoder)
{
	if((unsigned int) (micros() - (*encoder.lastReadTime)) > (unsigned int) encoder.refreshTime)
	{
		if(micros() - (*encoder.lastReadTime) < 1000000)
		{
			int currentEncoder = encoderGet(encoder.encoder);

			//lcdPrint(uart1, 2, "%d", currentEncoder - *encoder.lastEncoder);

			double velocity = (double) ((double) (currentEncoder - (*encoder.lastEncoder)) /
				(double) (micros() - (*encoder.lastReadTime)));

			*encoder.lastEncoder = encoderGet(encoder.encoder);

			*encoder.lastReadTime = micros();

			velocity *= 100000;

			//lcdPrint(uart1, 2, "%f", velocity);

			*encoder.velocity = velocity;
		}
		else
		{
			(*encoder.lastEncoder) = encoderGet(encoder.encoder);
			(*encoder.lastReadTime) = micros();
			(*encoder.velocity) = 0;
			lcdSetText(uart1, 2, "Timeout");
		}

	}

	//lcdPrint(uart1, 1, "C%d", (unsigned int) micros());
	//lcdPrint(uart1, 2, "L%d", (unsigned int) micros() - *encoder.lastReadTime);
	//lcdPrint(uart1, 2, "%f", *encoder.velocity);

	return *encoder.velocity;
}
Esempio n. 5
0
double getRedEncoderVelocity(RedEncoder encoder)
{
	if(micros() - (*encoder.lastReadTime) > 100000)
	{
		if(micros() - (*encoder.lastReadTime) < 1000000)
		{
			int currentEncoder = encoderGet(encoder.encoder);

			double velocity = (double) ((double) (currentEncoder - (*encoder.lastEncoder)) /
				(double) (micros() - (*encoder.lastReadTime)));

			*encoder.lastEncoder = encoderGet(encoder.encoder);

			*encoder.lastReadTime = micros();

			velocity *= 100000;

			//lcdPrint(uart1, 1, "%f", velocity);

			*encoder.velocity = velocity;

			//lcdSetText(uart1, 2, "Update");
		}
		else
		{
			(*encoder.lastEncoder) = encoderGet(encoder.encoder);
			(*encoder.lastReadTime) = micros();
			(*encoder.velocity) = 0;
			lcdSetText(uart1, 2, "Timeout");
		}

	}

	//lcdPrint(uart1, 1, "%f", *encoder.velocity);

	return *encoder.velocity;
}
Esempio n. 6
0
void autonSelectMenu() {
	lcdSetBacklight(uart1, true);
	while (button != LCD_BTN_CENTER) {
		lcdClear(uart1);

		lcdSetText(uart1, 1, "Alliance Color?");
		lcdSetText(uart1, 2, "< Red     Blue >");

		button = getLcdButtons();

		if (button == LCD_BTN_LEFT) {
			lcdClear(uart1);

			lcdSetText(uart1, 1, "Starting Side?");
			lcdSetText(uart1, 2, "< Middle  Hang >");

			while (button != LCD_BTN_LEFT || button != LCD_BTN_RIGHT) {
				button = getLcdButtons();

				// Red Middle
				if (button == LCD_BTN_LEFT) {
					int screen = 0;
					int minScreen = 0;
					int maxScreen = 4;

					lcdClear(uart1);

					while (button != LCD_BTN_CENTER) {
						switch (screen) {
							case 0:
								lcdSetText(uart1, 1, "auton one");
								break;
							case 1:
								lcdSetText(uart1, 1, "auton two");
								break;
							case 2:
								lcdSetText(uart1, 1, "auton three");
								break;
							case 3:
								lcdSetText(uart1, 1, "auton four");
								break;
						}

						button = getLcdButtons();

						if (button == LCD_BTN_RIGHT) {
							if (++screen > maxScreen)
								screen = minScreen;
						} else if (button == LCD_BTN_LEFT) {
							if (--screen < minScreen)
								screen = maxScreen;
						}
					}

					autonSelection = screen;
					lcdSetText(uart1, 1, "   AUTONOMOUS");
					lcdSetText(uart1, 2, "      SET");
					taskDelay(400);
					return;
				}

				// Red Hang
				if (button == LCD_BTN_RIGHT) {
					int screen = 0;
					int minScreen = 0;
					int maxScreen = 4;

					lcdClear(uart1);

					while (button != LCD_BTN_CENTER) {
						switch (screen) {
							case 0:
								lcdSetText(uart1, 1, "auton one");
								break;
							case 1:
								lcdSetText(uart1, 1, "auton two");
								break;
							case 2:
								lcdSetText(uart1, 1, "auton three");
								break;
							case 3:
								lcdSetText(uart1, 1, "auton four");
								break;
						}

						button = getLcdButtons();

						if (button == LCD_BTN_RIGHT) {
							if (++screen > maxScreen)
							screen = minScreen;
						} else if (button == LCD_BTN_LEFT) {
							if (--screen < minScreen)
								screen = maxScreen;
						}
					}

					autonSelection = screen;
					lcdSetText(uart1, 1, "   AUTONOMOUS");
					lcdSetText(uart1, 2, "      SET");
					taskDelay(400);
					return;
				}
			}
		}

		if (button == LCD_BTN_RIGHT) {
			lcdClear(uart1);

			lcdSetText(uart1, 1, "Starting Side?");
			lcdSetText(uart1, 2, "< Middle  Hang >");

			while (button != LCD_BTN_LEFT || button != LCD_BTN_RIGHT) {
				button = getLcdButtons();

				// Blue Middle
				if (button == LCD_BTN_LEFT) {
					int screen = 0;
					int minScreen = 0;
					int maxScreen = 4;

					lcdClear(uart1);

					while (button != LCD_BTN_CENTER) {
						switch (screen) {
							case 0:
								lcdSetText(uart1, 1, "auton one");
								break;
							case 1:
								lcdSetText(uart1, 1, "auton two");
								break;
							case 2:
								lcdSetText(uart1, 1, "auton three");
								break;
							case 3:
								lcdSetText(uart1, 1, "auton four");
								break;
						}

						button = getLcdButtons();

						if (button == LCD_BTN_RIGHT) {
							if (++screen > maxScreen)
								screen = minScreen;
						} else if (button == LCD_BTN_LEFT) {
							if (--screen < minScreen)
								screen = maxScreen;
						}
					}

					autonSelection = screen;
					lcdSetText(uart1, 1, "   AUTONOMOUS");
				    lcdSetText(uart1, 2, "      SET");
					taskDelay(400);
					return;
				}

				// Blue Hang
				if (button == LCD_BTN_RIGHT) {
					int screen = 0;
					int minScreen = 0;
					int maxScreen = 4;

					lcdClear(uart1);

					while (button != LCD_BTN_CENTER) {
						switch (screen) {
							case 0:
								lcdSetText(uart1, 1, "auton one");
								break;
							case 1:
								lcdSetText(uart1, 1, "auton two");
								break;
							case 2:
								lcdSetText(uart1, 1, "auton three");
								break;
							case 3:
								lcdSetText(uart1, 1, "auton four");
								break;
						}

						button = getLcdButtons();

						if (button == LCD_BTN_RIGHT) {
							if (++screen > maxScreen)
								screen = minScreen;
						} else if (button == LCD_BTN_LEFT) {
							if (--screen < minScreen)
								screen = maxScreen;
						}
					}

					autonSelection = screen;
					lcdSetText(uart1, 1, "   AUTONOMOUS");
					lcdSetText(uart1, 2, "      SET");
					taskDelay(400);
					return;
				}
			}
		}
	}
}
Esempio n. 7
0
__interrupt void watchdog_timer(void)
{
	int x = debounceSwitch();
	switch(alarm_state)
	{
		case(0):
			lcdSetText("ALARM NOT SET",0,0);
			if((x == BIT7) && prevState == 0x0000){//if the left button is pressed in state 0, begin setting the alarm
				alarm_state = 1;
				lcdClear();
				lcdSetText("Set Hour:",0,0);
				lcdSetText(text,0,1);
			}
			break;
		case(1):
			if(x == BIT5 && prevState ==0x0000){//press the right button to increment the hours
				text[1] ++;
				if(text[1] == '0' + 10 ||(text[0] =='2' && text[1] == '5')) text[1] = '0';
				if(text[1]=='0') text[0]++;
				if(text[0] == '3') text[0] = '0';
			}else if(x == BIT7 && prevState ==0x000){ //press the left button to switch to setting the minutes
				alarm_state = 2;
				lcdClear();
				lcdSetText("Set Minute:",0,0);
			}
			lcdSetText(text,0,1);
			break;
		case(2):
			if(x == BIT5 && prevState ==0x0000){//press the right button to increment the minutes
				text[4] ++;
				if(text[4] == '0' + 10) text[4] = '0';
				if(text[4]=='0') text[3]++;
				if(text[3] == '7') text[3] = '0';
			}else if(x == BIT7 && prevState ==0x000){ //press the left button to set the alarm
				serialWrite('r');
				lcdClear();
				lcdSetText("ALARM SET:",0,0);
				alarm_state = 3;
			}
			lcdSetText(text,0,1);
			break;
		case(3):
			if(x == BIT7 && prevState ==0x0000){ // if waiting for alarm and want reset, transmit S character
				serialWrite('S');
				alarm_state = 0;
				lcdClear();
				lcdSetText("ALARM NOT SET",0,0);
			}
			break;
		case(4):
			if(x == BIT7 && prevState ==0x0000){// if alarm going off and want reset, transmit o character and turn off alarm
				serialWrite('o');
				TA0CCR1 = 0;
				alarm_state = 0;
				lcdClear();
				lcdSetText("ALARM NOT SET",0,0);
			}
			break;

	}
}
Esempio n. 8
0
/*void lcdAutonRecorder(){
  if ((lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD == LCD_BTN_CENTER) || menuStay == LCD_BTN_CENTER){
    lcdClear(uart1);
    menuStay == LCD_BTN_CENTER;
    arbitraryVariable = 1;
    lcdSetText(uart1, 1, "CONFIRM");
    if (((lcdReadButtons(uart1) == LCD_BTN_RIGHT && previousLCD == LCD_BTN_RIGHT) || endResultMenu == LCD_BTN_RIGHT) && arbitraryValueTwo = 0){
      for (int j = 1; j < 4; j ++){
        lcdClear(uart1);
        lcdSetText(uart1, 1, "Recording in...");
        lcdSetText(uart1, 2, j);
      }
      lcdClear(uart1);
      lcdSetText(uart1, 1, "Recording");
      record();
      lcdClear(uart1);
      lcdSetText(uart1, 1, "Finished");
      delay(1000);
      lcdClear(uart1);
      lcdSetText(uart1, 1, "Save?");
      lcdSetText(uart1, 2, "No     Yes");
      if((lcdReadButtons(uart1) == LCD_BTN_RIGHT && previousLCD == LCD_BTN_RIGHT) || endResult_Menu_Inner == LCD_BTN_RIGHT){
        endResult_Menu_Inner = LCD_BTN_RIGHT;
        arbitraryValueTwo = 1;
        if (lcdReadButtons(uart1) == LCD_BTN_LEFT && previousLCD != LCD_BTN_LEFT){// if clicked now, and not clicked 100 ms before
          autonRecorderMenuCount--;
        }
        else if (lcdReadButtons(uart1) == LCD_BTN_RIGHT && previousLCD != LCD_BTN_RIGHT){
          autonRecorderMenuCount++;
        }
        if (autonRecorderMenuCount < 0){
          autonRecorderMenuCount = autonRecorderMaxNumberMenus;
        }
        else if (autonRecorderMenuCount > autonRecorderMaxNumberMenus){
          autonRecorderMenuCount = 0;
        }
        switch(autonRecorderMenuCount){
          case 0:
            lcdClear(uart1);
            lcdSetText(uart1, 1, "Auton Left");
            if(lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD != LCD_BTN_CENTER){
              saveAuton(Auton_one, "Auton_1");
              menuCount = 0;
              menuStay = 0;
              arbitraryVariable = 0;
              endResultMenu = 0;
              endResult_Menu_Inner = 0;
              arbitraryValueTwo = 0;
            }
            break;
          case 1:
            lcdClear(uart1);
            lcdSetText(uart1, 1, "Auton Right");
            if (lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD != LCD_BTN_CENTER){
              saveAuton(Auton_two, "Auton_2");
              menuCount = 0;
              menuStay = 0;
              arbitraryVariable = 0;
              endResultMenu = 0;
              endResult_Menu_Inner = 0;
              arbitraryValueTwo = 0;
            }
            break;
        }
      }
      else if((lcdReadButtons(uart1) == LCD_BTN_LEFT && previousLCD == LCD_BTN_LEFT) && arbitraryValueTwo = 0){
        menuCount = 0;
        menuStay = 0;
        arbitraryVariable = 0;
        endResultMenu = 0;
      }
    }
    else if ((lcdReadButtons(uart1) == LCD_BTN_LEFT && previousLCD == LCD_BTN_LEFT)){
      menuCount = 0;
      menuStay = 0;
      arbitraryVariable = 0;
      endResultMenu = 0;
    }
  }
}
*/
void lcdMotor(){// code for the motor sub menu and displays
  if ((lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD == LCD_BTN_CENTER) || menuStay == LCD_BTN_CENTER){
    lcdClear(uart1);
    arbitraryVariable = 1;
    menuStay = LCD_BTN_CENTER;
    // motor menu!!
    if (lcdReadButtons(uart1) == LCD_BTN_LEFT && previousLCD != LCD_BTN_LEFT){// if clicked now, and not clicked 100 ms before
      motorMenuCount--;
    }
    else if (lcdReadButtons(uart1) == LCD_BTN_RIGHT && previousLCD != LCD_BTN_RIGHT){
      motorMenuCount++;
    }
    if (motorMenuCount < 0){
      motorMenuCount = motorMaxNumberMenus;
    }
    else if (motorMenuCount > motorMaxNumberMenus){
      motorMenuCount = 0;
    }
    switch(motorMenuCount){
      case 0:
        lcdClear(uart1);
        lcdSetText(uart1, 1, "Top Left Drive");
        snprintf(front_left_driveLCD, 17, "%d", (motorGet(front_left_drive)));
        lcdSetText(uart1, 2, front_left_driveLCD);
        if (lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD != LCD_BTN_CENTER){
          menuCount = 0;
          menuStay = 0;
          arbitraryVariable = 0;
          endResultMenu = 0;
        }
      break;
      case 1:
        lcdClear(uart1);
        lcdSetText(uart1, 1, "Top Right Drive");
        snprintf(front_right_driveLCD, 17, "%d", (motorGet(front_right_drive)));
        lcdSetText(uart1, 2, front_right_driveLCD);
        if (lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD != LCD_BTN_CENTER){
          menuCount = 0;
          menuStay = 0;
          arbitraryVariable = 0;
          endResultMenu = 0;
        }
      break;
      case 2:
        lcdClear(uart1);
        lcdSetText(uart1, 1, "Back Left Drive");
        snprintf(back_left_driveLCD, 17, "%d", (motorGet(back_left_drive)));
        lcdSetText(uart1, 2, back_left_driveLCD);
        if (lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD != LCD_BTN_CENTER){
          menuCount = 0;
          menuStay = 0;
          arbitraryVariable = 0;
          endResultMenu = 0;
        }
      break;
      case 3:
        lcdClear(uart1);
        lcdSetText(uart1, 1, "Back Right Drive");
        snprintf(back_right_driveLCD, 17, "%d", (motorGet(back_right_drive)));
        lcdSetText(uart1, 2, back_right_driveLCD);
        if (lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD != LCD_BTN_CENTER){
          menuCount = 0;
          menuStay = 0;
          arbitraryVariable = 0;
          endResultMenu = 0;
        }
      break;
      case 4:
        lcdClear(uart1);
        lcdSetText(uart1, 1, "Lift 1");
        snprintf(left_lift_Motor1LCD, 17, "%d", (motorGet(left_lift_Motor1)));
        lcdSetText(uart1, 2, left_lift_Motor1LCD);
        if (lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD != LCD_BTN_CENTER){
          menuCount = 0;
          menuStay = 0;
          arbitraryVariable = 0;
          endResultMenu = 0;
        }
      break;
      case 5:
        lcdClear(uart1);
        lcdSetText(uart1, 1, "Lift 2");
        snprintf(left_lift_Motor2LCD, 17, "%d", (motorGet(left_lift_Motor2)));
        lcdSetText(uart1, 2, left_lift_Motor2LCD);
        if (lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD != LCD_BTN_CENTER){
          menuCount = 0;
          menuStay = 0;
          arbitraryVariable = 0;
          endResultMenu = 0;
        }
      break;
      case 6:
        lcdClear(uart1);
        lcdSetText(uart1, 1, "Lift 3");
        snprintf(right_lift_Motor3LCD, 17, "%d", (motorGet(right_lift_Motor3)));
        lcdSetText(uart1, 2, right_lift_Motor3LCD);
        if (lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD != LCD_BTN_CENTER){
          menuCount = 0;
          menuStay = 0;
          arbitraryVariable = 0;
          endResultMenu = 0;
        }
      break;
      case 7:
        lcdClear(uart1);
        lcdSetText(uart1, 1, "Lift 4");
        snprintf(right_lift_Motor4LCD, 17, "%d", (motorGet(right_lift_Motor4)));
        lcdSetText(uart1, 2, right_lift_Motor4LCD);
        if (lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD != LCD_BTN_CENTER){
          menuCount = 0;
          menuStay = 0;
          arbitraryVariable = 0;
          endResultMenu = 0;
        }
      break;
      case 8:
      lcdClear(uart1);
      lcdSetText(uart1, 1, "Pincer Left");
      snprintf(pincer_leftLCD, 17, "%d", (motorGet(pincer_left)));
      lcdSetText(uart1, 2, pincer_leftLCD);
      if (lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD != LCD_BTN_CENTER){
        menuCount = 0;
        menuStay = 0;
        arbitraryVariable = 0;
        endResultMenu = 0;
      }
      break;
      case 9:
      lcdClear(uart1);
      lcdSetText(uart1, 1, "Pincer Right");
      snprintf(pincer_rightLCD, 17, "%d", (motorGet(pincer_right)));
      lcdSetText(uart1, 2, pincer_rightLCD);
        if (lcdReadButtons(uart1) == LCD_BTN_CENTER && previousLCD != LCD_BTN_CENTER){
          menuCount = 0;
          menuStay = 0;
          arbitraryVariable = 0;
          endResultMenu = 0;
        }
      break;
    }
  }
}
Esempio n. 9
0
//lcd autonomous selection menu
void lcdAutoSelection() {
	short pageAuto = 0, maxPageAuto = 6;
	short autoSelected = 0, colorSelected = 0;
	short pageColor = red;
	//while we are disabled before match
	while (isEnabled() == false) {
		//have not selected routine yet
		if (!autoSelected) {
			//display 1 routine option at a time
			if (pageAuto == stacks)
				lcdSetText(uart1, 1, "stacks");
			else if (pageAuto == intercept)
				lcdSetText(uart1, 1, "intercept");
			else if (pageAuto == preloads)
				lcdSetText(uart1, 1, "preloads only");
			else if (pageAuto == hoard)
				lcdSetText(uart1, 1, "hoarding");
			else if (pageAuto == skills)
				lcdSetText(uart1, 1, "skills");
			else if (pageAuto == nothing)
				lcdSetText(uart1, 1, "do nothing");

			//wrap back around when we get to last routine
			if (pageAuto < 1)
				pageAuto = maxPageAuto;
			else if (pageAuto > maxPageAuto)
				pageAuto = 1;

			//switch between routines
			if (lcdReadButtons(uart1) == LCD_BTN_LEFT) {
				pageAuto--;
				while (lcdReadButtons(uart1) == LCD_BTN_LEFT)
					delay(20);
			} else if (lcdReadButtons(uart1) == LCD_BTN_RIGHT) {
				pageAuto++;
				while (lcdReadButtons(uart1) == LCD_BTN_RIGHT)
					delay(20);
			}

			//select current routine with center button
			if (lcdReadButtons(uart1) == LCD_BTN_CENTER) {
				autonomousMode = pageAuto;
				if (pageAuto == stacks)
					lcdSetText(uart1, 2, "stacks");
				else if (pageAuto == intercept)
					lcdSetText(uart1, 2, "intercept");
				else if (pageAuto == preloads)
					lcdSetText(uart1, 2, "preloads only");
				else if (pageAuto == hoard)
					lcdSetText(uart1, 2, "hoarding");
				else if (pageAuto == skills)
					lcdSetText(uart1, 2, "skills");
				else if (pageAuto == nothing)
					lcdSetText(uart1, 2, "do nothing");
				autoSelected = 1;
			}
		}
		//move on to select color
		else{
			if(pageColor == red)
				lcdSetText(uart1,1,"red");
			else
				lcdSetText(uart1,1,"blue");

			//switch color
			if(lcdReadButtons(uart1) == LCD_BTN_RIGHT){
				pageColor = -1*pageColor;
				while(lcdReadButtons(uart1) == LCD_BTN_RIGHT)
					delay(20);
			}

			//go back
			if(lcdReadButtons(uart1) == LCD_BTN_LEFT)
				autoSelected = 0;

			//save selection
			autonomousColor = pageColor;
		}
		delay(20);
	}
}
Esempio n. 10
0
void initialize() {
	setTeamName("750E");
	//int exit = 0;
	//imeReinitialize();
	lcdInit(uart2);
	lcdClear(uart2);
//			int count=0;
//			while (!exit) {
//				delay(20);
//
//		// Selecting which auton program.
//				if (joystickGetDigital(1,7,JOY_DOWN)|| joystickGetDigital(2,7,JOY_DOWN))
//				{
//					exit=1;
//				}
//				else
//				{
//					switch (count)
//					{
//		//Autonomous 1.
//					case 0:  lcdSetText(uart2,1, "Autonomous 1");
//					lcdSetText(uart2,2, "<    Select   >");
//					if (lcdReadButtons(uart2)==LCD_BTN_LEFT){
//						count=3;
//					}
//					else if (lcdReadButtons(uart2)==LCD_BTN_RIGHT){
//						count++;
//				         }
//		//If selected, display...
//					else if (lcdReadButtons(uart2)==LCD_BTN_CENTER){
//						lcdSetText(uart2,1,"Autonomous 1");
//						lcdSetText(uart2,2,"is running.");
//						exit=1;
//						break;
//					}
//					break;
//		//Autonomous	 2.
//					case 1: lcdSetText(uart2,1,"Autonomous 2");
//					lcdSetText(uart2,2,"<    Select    >");
//					if (lcdReadButtons(uart2)==LCD_BTN_LEFT){
//						count--;
//						}
//						else if (lcdReadButtons(uart2)==LCD_BTN_RIGHT){
//							count++;
//						}
//		//If selected, display...
//				         else if (lcdReadButtons(uart2)==LCD_BTN_CENTER){
//				        	 lcdSetText(uart2,1,"Autonomous 2");
//				        	 lcdSetText(uart2,2,"is running.");
//							 exit=1;
//				        	 break;
//				         }
//						break;
//		//Autonomous 3.
//				case 2: lcdSetText(uart2,1,"Autonomous 3");
//						lcdSetText(uart2,2,"<    Select    >");
//						if (lcdReadButtons(uart2)==LCD_BTN_LEFT){
//							count--;
//						}
//						else if (lcdReadButtons(uart2)==LCD_BTN_RIGHT){
//							count++;
//						}
//		//If selected, display...
//				         else if (lcdReadButtons(uart2)==LCD_BTN_CENTER){
//				        	 lcdSetText(uart2,1,"Autonomous 3");
//				        	 lcdSetText(uart2,2,"is running.");
//							 exit=1;
//				        	 break;
//				         }
//						break;
//		//Autonomous 4.
//				case 3: lcdSetText(uart2,1,"Autonomous 4");
//						lcdSetText(uart2,2,"<    Select   >");
//						if (lcdReadButtons(uart2)==LCD_BTN_LEFT){
//							count--;
//						}
//						else if (lcdReadButtons(uart2)==LCD_BTN_RIGHT){
//							count++;
//						}
//		//If selected, display...
//				         else if (lcdReadButtons(uart2)==LCD_BTN_CENTER){
//				        	 lcdSetText(uart2,1,"Autonomous 4");
//				        	 lcdSetText(uart2,2,"is running.");
//							 exit=1;
//				        	 break;
//				         }
//						break;
//				case 4: lcdSetText(uart2,1,"Self Destruct");
//										lcdSetText(uart2,2,"<    Select   >");
//										if (lcdReadButtons(uart2)==LCD_BTN_LEFT){
//											count--;
//										}
//										else if (lcdReadButtons(uart2)==LCD_BTN_RIGHT){
//											count=0;
//										}
//						//If selected, display...
//								         else if (lcdReadButtons(uart2)==LCD_BTN_CENTER){
//								        	 lcdSetText(uart2,1,"Autonomous 4");
//								        	 lcdSetText(uart2,2,"is running.");
//								        	 count=0;
//											 exit=1;
//								        	 break;
//								         }
//										break;
//
//				default: count=0;
//						 break;
//
//				}
//
//			}
//			auton = count+1;
//		}
		lcdSetText(uart2,1,"750EVOLUTION");
		lcdSetText(uart2,2,"THIS IS A ROBOT");
}