Beispiel #1
0
Datei: main.c Projekt: czig/Lab6
/*
 * main.c
 */
void main(void) {
    WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog timer

    //Delays dictate how long each function is executed. To move forward or backward a further distance,
    //increase the delay after the moveRobotForward or moveRobotBackward functions. To turn larger angles,
    //increase the delay after the turnRobotRight or turnRobotLeft functions.
    initRobot();
    __delay_cycles(3000000); //Delay here to give user time to get robot to floor
    moveRobotForward();
    __delay_cycles(1000000);
    stopRobot();
    __delay_cycles(1000000);
    moveRobotBackward();
    __delay_cycles(1000000);
    stopRobot();
    __delay_cycles(1000000);
    turnRobotRight();
    __delay_cycles(300000);
    stopRobot();
    __delay_cycles(1000000);
    turnRobotLeft();
    __delay_cycles(300000);
    stopRobot();
    __delay_cycles(1000000);
    turnRobotRight();
    __delay_cycles(900000);
    stopRobot();
    __delay_cycles(1000000);
    turnRobotLeft();
    __delay_cycles(900000);
    stopRobot();



    while(1)
    {

    }

}
Beispiel #2
0
/*
 * main.c
 */
int main(void) {
    WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog timer
	initRobot();

	  while (1) {

	      moveRobotForward(100);
	        __delay_cycles(700000);
	        moveRobotBackward(100);
	        __delay_cycles(700000);
	        turnRobotLeft(100);
	        __delay_cycles(700000);
	        turnRobotRight(100);
	        __delay_cycles(700000);
	        turnRobotLeft(100);
	        __delay_cycles(1500000);
	        turnRobotRight(100);
	        __delay_cycles(1500000);

	  }


}