Beispiel #1
0
int main(void) {
    char ch;
    InitializeMCU();
    CallEvery(blink, 0, 0.25f);

    while(1) {
        Printf("\nRAS Demo for Robotathon 2013\n");
        Printf(" 0=UART Demo\n 1=Motor Demo\n");
        Printf(" 2=Servo Demo\n 3=I2C Line Sensor Demo\n");
        Printf(" 4=IR Sensor Demo\n 5=Encoders Demo\n");
        Printf(" 6=GPIO Demo\n 7=GPIO Line Sensor Demo\n");
        
        Printf(">> ");
        // Read input from User
        ch = Getc();
        Printf("%c", ch);
        Printf("\n");

        switch(ch) {
            case '0':
                Printf("\n UART Demo\n");
                uartDemo();
                break;
            case '1':
                Printf("\nMotor Demo\n");
                initMotors();
                motorDemo();
                break;
            case '2':
                Printf("\nServo Demo\n");
                initServo();
                servoDemo();
                break;
            case '3':
                Printf("\nLine Sensor Demo\n");
                initI2CLineSensor();
                i2cLineSensorDemo();
                break;
            case '4':
                   Printf("\nIR Sensor Demo\n");
                initIRSensor();
                IRSensorDemo();
                break;
            case '5':
                Printf("\nEncoders Demo\n");
                initEncoders();
                encoderDemo();
                break;
            case '6':
                Printf("\nGPIO Demo\n");
                gpioDemo();
                break;
            case '7':
                Printf("\nGPIO Line Sensor Demo\n");
                initGPIOLineSensor();
                gpioLineSensorDemo();
                break;
        }
    }
}
Beispiel #2
0
// The 'main' function is the entry point of the program
int main(void) {
    // Initialization code can go here
    CallEvery(blink, 0, 0.5);
    
    while (1) {
        // Runtime code can go here
        Printf("Hello World!\n");
        
    }
}
Beispiel #3
0
int main(void) {

	//char input;
	PIDStruct s;
	
	CallEvery(blink, 0, 0.5);
	
	//armServo = InitializeServo(PIN_B2);
	handServo = InitializeServo(PIN_B3);
	InitGearMotor();
	initializeIRSensors();
	initBootlegMotor();

	//grabBall();	
	//Wait(3.0);
	//dropBall();

	//while(1);

	//while(1) __asm("");

	//SetGearMotor(.5, .5);
	//setBootlegMotor(0.7);

	grabBall();
	dropBall();

	while(true)
	{
		//grabBall();

		//float hup = getPosition();
		//Printf("%f \n", (hup));
//		runPID(&s, 0);
		//get input somehow?
//		if(input == 32)		//also needs input to activate sprinting speed
//			manualControl();
		//setBootlegMotor(0.5);
		//Wait(2.0);
		//setBootlegMotor(1.0);
	}

}