예제 #1
0
void autonomous()
{

	int jumper1 = digitalRead(1);
	int jumper2 = digitalRead(2);
	int jumper3 = digitalRead(3);

	AUTONOMOUS_MODE jumperMask = jumper1 | (jumper2 << 1) | (jumper3 << 2);

	//TODO review note below
	//NOTE i think it makes more sense to make the MSB the "colour switch"
	// J3 J2 J1 bitmask - Up to 8 modes possible
	switch (jumperMask)
	{
	case RUSH_BLUE:   		// 0 0 0
		rushBlue();
		break;
	case CLASSIC15_BLUE: 	// 0 0 1
		classic15Blue();
		break;
	case RUSH_RED: 			// 0 1 0
		rushRed();
		break;
	case CLASSIC15_RED: 	// 0 1 1
		classic15Red();
		break;
	case REJECTION_BLUE:	// 1 0 0
		rejectionBlue();
		break;
	case REJECTION_RED: 	// 1 0 1
		rejectionRed();
		break;
	case RESERVED6:			// 1 1 0
		rejectionBlue();
		break;
	case RESERVED7:			// 1 1 1
		rejectionBlue();
		break;
	default: // uncaught
		rejectionBlue();
		break;
	}
	//TODO Delete, replaced by above switch statement
	/*
	 //1 = out
	 // 0 = in
	 if ((jumper1 == 0) && (jumper2 == 0))
	 {
	 rushBlue();
	 }

	 if ((jumper1 == 0) && (jumper3 == 0))
	 {
	 classic15Blue();
	 }

	 if ((jumper1 == 1) && (jumper2 == 0))
	 {
	 rushRed();
	 }

	 if ((jumper1 == 1) && (jumper3 == 0))
	 {
	 classic15Red();
	 }

	 if (jumper1 == 0)
	 {
	 rejectionBlue();
	 }

	 if (jumper1 == 1)
	 {
	 rejectionRed();
	 }
	 */

	//TODO What is the below, it appears to be dead code
//forwardDetect (1000);
//armUpTrim();
//findLineRight();
//followLine(1200);
//rejectionRed();
//rejectionBlue();
//classic15Red();
//classic15Blue();
//rushRed();
//rushBlue();
//kakitRed ();
// all jumper comands here:
}
예제 #2
0
파일: auto.c 프로젝트: murdomeek/Worlds2014
void autonomous()
{

int jumper1 = digitalRead (1);
int jumper2 = digitalRead (2);
int jumper3 = digitalRead (3);


//1 = out
// 0 = in
if ((jumper1 == 0) && (jumper2 == 0))
{
	rushBlue();
}

if ((jumper1 == 0) && (jumper3 == 0))
{
	classic15Blue();
}

if ((jumper1 == 1) && (jumper2 == 0))
{
	rushRed();
}

if ((jumper1 == 1) && (jumper3 == 0))
{
	classic15Red();
}

if (jumper1 == 0)
{
	rejectionBlue();
}

if (jumper1 == 1)
{
	rejectionRed();
}

//forwardDetect (1000);

//armUpTrim();
//findLineRight();
//followLine(1200);

//rejectionRed();
rejectionBlue();

//classic15Red();
//classic15Blue();
//rushRed();
//rushBlue();
//kakitRed ();

// all jumper comands here:





}