Example #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;
        }
    }
}
Example #2
0
int main(void)
{	
	char ch;	  	 
	LockoutProtection();
	InitializeMCU();
	initUART();																							    
	
	while(1) {	
		UARTprintf("\nROBZ DEMO\n");
		UARTprintf("  0=UART Demo\n  1=Motor Demo\n");
		UARTprintf("  2=Servo Demo\n  3=Line Sensor\n");
		UARTprintf("  4=IR Sensor Demo\n  5=Encoders Demo\n");
		
		UARTprintf(">> ");
		ch = getc();
		putc(ch);
		UARTprintf("\n");

		if (ch == '0') {
			UARTprintf("\nUART Demo\n");
			uartDemo();	 
		}
		else if (ch == '1') {
			UARTprintf("\nMotor Demo\n");
			initMotors();
			motorDemo(); 
		}
		else if (ch == '2') {
			UARTprintf("\nServo Demo\n");
			initServo();
			servoDemo();   
		}
		else if (ch == '3') {			   
			UARTprintf("\nLine Sensor Demo\n");
			initLineSensor();		  
			lineSensorDemo();
		}
		else if (ch == '4') {	   
			UARTprintf("\nIR Sensor Demo\n");
			initIRSensor();
			IRSensorDemo();	 
		}
		else if (ch == '5') {
			UARTprintf("\nEncoders Demo\n");
			initEncoders();
			encoderDemo();
		}
	}
}