 | Code: #pragma config(Hubs, S1, MatrxRbtcs, none, none, none) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Motor, motorA, BeaterLeft, tmotorNXT, PIDControl, encoder) #pragma config(Motor, motorB, BeaterRight, tmotorNXT, PIDControl, encoder) #pragma config(Motor, motorC, , tmotorNXT, openLoop) #pragma config(Motor, mtr_Matrix_S1_1, LiftArm, tmotorMatrix, PIDControl, encoder) #pragma config(Motor, mtr_Matrix_S1_2, motorE, tmotorMatrix, openLoop) #pragma config(Motor, mtr_Matrix_S1_3, motorF, tmotorMatrix, openLoop) #pragma config(Motor, mtr_Matrix_S1_4, motorG, tmotorMatrix, openLoop) #pragma config(Servo, srvo_Matrix_S1_1, servo1, tServoNone) #pragma config(Servo, srvo_Matrix_S1_2, servo2, tServoNone) #pragma config(Servo, srvo_Matrix_S1_3, servo3, tServoNone) #pragma config(Servo, srvo_Matrix_S1_4, servo4, tServoNone) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
/* Here's where the work is done, main task is what is run when the program starts */ task main(){ //Initialise starting positions nMotorEncoder[LiftArm]=0; nMotorEncoderTarget[LiftArm]=-1500; wait10Msec(10); //delay while variables are updated
motor[LiftArm]=-80; //set power to the motor to run to the encoder target while (nMotorRunState[LiftArm] != runStateIdle ) { //do nothing until the encoder target is reached; } motor[LiftArm]=0; //stop the motor
nMotorEncoderTarget[LiftArm]=-200; //set the motor to a new target position wait10Msec(10);
motor[LiftArm]=80; while (nMotorRunState[LiftArm] != runStateIdle ) { //do nothing } motor[LiftArm]=0; } |  |