Code: #pragma config(Hubs, S1, HTMotor, none, none, none) #pragma config(Motor, motorA, , tmotorNormal, PIDControl, reversed, encoder) #pragma config(Motor, mtr_S1_C1_1, kicker, tmotorNormal, PIDControl, encoder) #pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, PIDControl, encoder) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.
void initializeRobot() { motor[kicker] = 0;
return; }
task main() { //Motor control variables int kickerSpeed = 70; // this is the motor speed a vaule under 75 is more consistant but can be changed int pauseTime = 100;
//Variable action list //this number may be changed depending what you want to do int kickForwardCount = 720;
// the number 720 comes from the number 1440, while using tetrix encoders the vaules are 360 rotations and then multipled by 4.
initializeRobot();
waitForStart(); // Wait for the beginning of autonomous phase.
//////////////////////////////////////////// //////////////////////////////////////////// ///// Kick ///// //////////////////////////////////////////// ////////////////////////////////////////////
nMotorEncoder[kicker] = 0; // it is important to zero the encoders to get the same results everytime
while(nMotorEncoder[kicker] < kickForwardCount) { motor[kicker] = kickerSpeed; // if the kicker is kicking the wrong way change the kickerSpeed to "-70" } motor[kicker] = 0;
wait10Msec(pauseTime);
}
|