当前位置: 首页>>代码示例>>C++>>正文


C++ ClearTimer函数代码示例

本文整理汇总了C++中ClearTimer函数的典型用法代码示例。如果您正苦于以下问题:C++ ClearTimer函数的具体用法?C++ ClearTimer怎么用?C++ ClearTimer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ClearTimer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

//This code measures how quickly a battery will drain (please start as fully charged)//
task main()
{
	waitForStart();
	nMotorEncoder(Right) = 0;
	nMotorEncoder(Left) = 0;
	wait1Msec(50);

	ClearTimer(T2);

	motor[Right] = speed;
	motor[Left] = -speed;
	AddToDatalog(speedDat, speed);
	wait1Msec(8000);
	//Get up to speed//
	ClearTimer(T1);
	startVolts = nAvgBatteryLevel;
	while(time1(T1) < 10000){
	}
	//Starting encoder ticks per second//
	encSpeed = ((nMotorEncoder(Right) / 10) + (abs(nMotorEncoder(Left)) / 10)) / 2;
	AddToDatalog(encSpeedDat, encSpeed);
	AddToDatalog(startVoltsDat, startVolts);

	newSpeed = encSpeed;

	//Run while at 80% of original speed or greater//
	while(newSpeed >= (encSpeed * 80 / 100)){
		ClearTimer(T1);

		nMotorEncoder(Right) = 0;
		nMotorEncoder(Left) = 0;
		wait1Msec(50);

		while(time1(T1) < 10000){
		}
		//Current encoder ticks per second//
		newSpeed = ((nMotorEncoder(Right) / 10) + (abs(nMotorEncoder(Left)) / 10)) / 2;
		AddToDatalog(newSpeedDat, newSpeed);
		AddToDatalog(newVoltsDat, nAvgBatteryLevel);
	}

  time = time100(T2) / 10;
	AddToDatalog(timeDat, time);
	SaveNxtDatalog();
}
开发者ID:cookthebook,项目名称:2014-2015TempestFTC,代码行数:46,代码来源:BatteryDatalog.c

示例2: ArmBase

// Moves the arm to base height
void ArmBase()
{
    ClearTimer(T1);
    while(SensorValue[P1] + SensorValue[P2] < 2212 && time1[T1] < 3000)
    {
        Arm(127);
    }
    Trim();
}
开发者ID:Skeer,项目名称:5000A,代码行数:10,代码来源:Functions.c

示例3: ArmWall

// Moves the arm to wall height
void ArmWall()
{
    ClearTimer(T1);
    while(SensorValue[P1] + SensorValue[P2] < 2700 && time1[T1] < 4500)
    {
        Arm(127);
    }
    Trim();
}
开发者ID:Skeer,项目名称:5000A,代码行数:10,代码来源:Functions.c

示例4: Foreground

task Foreground(){
  int timeLeft;
	while(true){
		ClearTimer(T1);
		hogCPU();
		//--------------------Robot Code---------------------------//

		long robotDist = nMotorEncoder[rtWheelMotor] + nMotorEncoder[ltWheelMotor];
		int robotDir  = (int)(nMotorEncoder[ltWheelMotor] - nMotorEncoder[rtWheelMotor]);

		// Calculate the speed and direction commands
//    int speedCmd = ForwardDist(path[pathIdx][DIST_IDX], robotDist, path[pathIdx][SPD_IDX]);
//		int dirCmd=Direction(path[pathIdx][DIR_IDX], robotDir, path[pathIdx][DIRRL_IDX]);

//		DebugInt("spd",speedCmd);
//		DebugInt("dir",dirCmd);

		#define FWDa 1
		#define	RT90a 2
		int sm=FWD1;
		int speedCmd=0;
		int dirCmd=0;

		switch sm {
		case FWDa: //Drive Forward
    	speedCmd = ForwardDist(10, robotDist, 50);// CmdStopDist,,CmdSpeed
			dirCmd=Direction(0, robotDir, 50);// CmdDir,,RateLimitValue
			break;
		default:
		}
		// Calculate the motor commands given the speed and direction commands.
//		motor[ltWheelMotor]=speedCmd+dirCmd;
//		motor[rtWheelMotor]=speedCmd-dirCmd;

		//--------------------------Robot Code--------------------------//
		// Wait for next itteration
	  timeLeft=FOREGROUND_MS-time1[T1];
	  releaseCPU();
	  wait1Msec(timeLeft);
	}// While
}//Foreground
task main()
{
	//--------------------INIT Code---------------------------//
  ForwardDistReset((tMotor)rtWheelMotor, (tMotor)ltWheelMotor);
	DirectionReset();
	//--------------------End INIT Code--------------------------//

  StartTask(Foreground, 255);

  while(true){

  	//-----------------Print the debug statements out------------------//
		DebugPrint();

	}// While
}// Main
开发者ID:Zero2848,项目名称:FTCTeam6189,代码行数:57,代码来源:m_smoothTurn.c

示例5: CenterGoal

int CenterGoal() {
	ClearTimer(T4);
	retractKnocker();
	turnUltra(0, 90);
	StartTask(raiseLift);
	moveDistanceRamp(40, 20);
	pause(1);
	int position = detectPosition();
	switch(position) {
		case 1:
			sound(1, 0.2);
			CenterPosition1();
			break;
		case 2:
			sound(2, 0.2);
			CenterPosition2();
			break;
		case 3:
			sound(3, 0.2);
			CenterPosition3();
			break;
		default:
			return -1;
	}

	deployClamp();
	while(!lifted);
	//int position = 2;
	readAllSwitches();
	//scoring commences
	bool anything_pressed = false;
	bool called_already = true;
	translateRTHeading(100, 90);
	while(!sideSwitch || !armSwitch) {
		readAllSwitches();
		if(tipSwitch) {
			translating = false;
			called_already = false;
			move(-20);
		}
		else if(sideSwitch) {
			translating = false;
			called_already = false;
			move(20);
		}
		else if(!called_already) {
			translateRTHeading(100, 90);
			called_already = true;
		}
		pause(0.2);
	}
	PlaySound(soundBeepBeep);
	scoreBall();
	move(0);
	translating = false;
	return position;
}
开发者ID:lexrobotics,项目名称:2015-4029,代码行数:57,代码来源:CenterGoal-menu.c

示例6: main

task main()
{
	while (true)
	{
		if(joystick.joy1_TopHat == 0)
		{
			ClearTimer(T1);
			int total = 0;
			while(time1[T1] < 3000)
			{
				if(joystick.joy1_TopHat > -1)
				{
					total = total + joystick.joy1_TopHat;
				}
			}
			if(total == 24)
			{
				ClearTimer(T1);
				while(time1[T1] < 1000)
				{
					if(joy1Btn(3) == 1)
					{
						ClearTimer(T1);
						while(time1[T1] < 1000)
						{
							if(joy1Btn(2) == 1)
							{
								ClearTimer(T1);
								while(time1[T1] < 1000)
								{
									if(joy1Btn(9) == 1)
									{
										motor[leftMotor] = 50;
										motor[rightMotor] = -50;
									}
								}
							}
						}
					}
				}
			}
		}
	}
}
开发者ID:FIRST-4030,项目名称:FTC-2013,代码行数:44,代码来源:Konami_Code_Fun.c

示例7: turnPointLeft

void turnPointLeft (float mRot, float mRotPerSec)
{
	nxtDisplayCenteredTextLine(5, "TPL(%.2f,%.2f)",
		mRot, mRotPerSec);

	if (moveModeType != MMAllMoveTypes
	      && moveModeType != MMTurnsOnly
	      && moveModeType != MMPointTurnsOnly) {
		return;
	}

	if (moveModeTiming == MMOneMoveAtATime) {
		waitForTouch();
	}


	if (stepThroughMode == stepThroughModeOn) {
		waitForTouch();
	}

	checkParameterRange(mRot, mRotPerSec);

	int leftWheelInitial = nMotorEncoder[leftWheelMotor];
	int rightWheelInitial = nMotorEncoder[rightWheelMotor];
	int leftWheelTarget = nMotorEncoder[leftWheelMotor] - 360 * mRot;
	int rightWheelTarget = nMotorEncoder[rightWheelMotor] + 360 * mRot;

	ClearTimer(T1);

	float motorPower = revolutionsPerSecondToMotorPower(mRotPerSec);
	motor[leftWheelMotor] = -1 * motorPower;
	motor[rightWheelMotor] = motorPower;

	while ((nMotorEncoder[leftWheelMotor] > leftWheelTarget)
		&& (nMotorEncoder[rightWheelMotor] < rightWheelTarget))
	{
		nxtDisplayCenteredTextLine(7, "%d", nMotorEncoder[leftWheelMotor]);
	}

	motor[leftWheelMotor] = 0;
	motor[rightWheelMotor] = 0;

	int leftWheelChange = nMotorEncoder[leftWheelMotor] - leftWheelInitial;
	int rightWheelChange = nMotorEncoder[rightWheelMotor] - rightWheelInitial;
	float revolutionsWheelsRotated =
	  ((float) ( abs(leftWheelChange) > abs(rightWheelChange) ?
	                leftWheelChange : rightWheelChange ))
	        / 360.0;

	nxtDisplayCenteredTextLine(2, "TPL(%.2f,%.2f)",
		mRot, mRotPerSec);
	nxtDisplayCenteredTextLine(3, "%.2frev %.2fsec",
	  (float) revolutionsWheelsRotated, (float) time10(T1) / 100);
	nxtDisplayCenteredTextLine(5, "");
	nxtDisplayCenteredTextLine(7, "");
}
开发者ID:brobots,项目名称:gateway-2012,代码行数:56,代码来源:RobotAlgebraInclude.c

示例8: main

task main()
{
	waitForStart();
	ClearTimer(T1);
	StartTask(firstMove);
	while(true)
	{
		wait1Msec(1);
	}
}
开发者ID:sssiegmeister,项目名称:First-Robotics,代码行数:10,代码来源:LouiseAutoGround2.c

示例9: raise

void raise()
{
	nMotorPIDSpeedCtrl[lift] = mtrNoReg;
	ClearTimer(T1);
	while( time1[T1] < 1500 )
		motor[lift] = -30;

	motor[lift] = 0;
	//nMotorPIDSpeedCtrl[lift] = mtrSpeedReg;
}
开发者ID:HALtheWise,项目名称:Hat-Trix-FTC,代码行数:10,代码来源:little+board+two.c

示例10: OnDestroy

/*-------------------------------------------------------
  WM_DESTROY message
---------------------------------------------------------*/
void OnDestroy(HWND hwnd)
{
	ClearTimer();
	
	KillTimer(hwnd, IDTIMER_TIMER);
	
	if(g_hfontDialog) DeleteObject(g_hfontDialog);
	
	PostQuitMessage(0);
}
开发者ID:k-takata,项目名称:TClockLight,代码行数:13,代码来源:main.c

示例11: initRobot

void initRobot() {
	servo[rampLatch] = 20;
	servo[platLatch] = 255;
	ClearTimer(T1);	 //Clear timer 1 for checking to see how long the robot waits before starting
	initDrivetrain();//Initialize systems
	initElevator();
	StartTask(ElevatorControlTask);	//begin elevator control task
	StartTask(SignalLight);
	setMode(IDLE);
}
开发者ID:jgermita,项目名称:FTC0072-2012-Robot_Code,代码行数:10,代码来源:TyphoonCommon.c

示例12: GyroTime_moveV2

// =======================================================================
// Function to move the robot by the gyro by time V2
// =======================================================================
void GyroTime_moveV2(int time, int power,bool StopWhenDone, bool adjust, bool ConstOrRel)
{
	relHeading =0;
	Current_Angle=0;   // reset current angle
	long adj_power;
	long adj_deg;
	wait1Msec(200);
	motor[LF_motor] = -power;
	motor[RF_motor] = power;
	motor[LB_motor] = -power;
	motor[RB_motor] = power;
	current_power = power;
	ClearTimer(T1);
	bool Done = false;
	while(!Done)
	{
		/*nxtDisplayTextLine(1, "ad: %3d", adj_deg);
		nxtDisplayTextLine(2, "R: %3d", (current_power + adj_power));
		nxtDisplayTextLine(3, "L: %3d", (current_power - adj_power));
		nxtDisplayTextLine(4, "ap: %3d", adj_power);*/
		nxtDisplayBigTextLine(2, "S: %3d", SensorValue[SONAR]);

		if(time1[T1] > time)
		{
			Done = true;
		}
		//----------------------------
		/*if(ConstOrRel) Current_Speed=constHeading;
		else Current_Speed=relHeading;
		Current_Angle= Current_Angle + (float)(Current_Speed/GCPD);
		wait1Msec(5);*/
		//----------------------------

		if(adjust == true)
		{
			if(ConstOrRel) adj_deg = (long) constHeading;
			else adj_deg = (long) relHeading;
			adj_power = adj_deg*GYRO_PROPORTION;
			/*adj_deg = (long) Current_Angle;
			adj_power = adj_deg*GYRO_PROPORTION;*/

			motor[LF_motor] = -(current_power - adj_power);
			motor[RF_motor] = (current_power + adj_power);
			motor[LB_motor] = -(current_power);
			motor[RB_motor] = (current_power);
		}
	}
	if(StopWhenDone==true)
	{
		motor[LF_motor] = 0;
		motor[RF_motor] = 0;
		motor[LB_motor] = 0;
		motor[RB_motor] = 0;
	}
}
开发者ID:GotRobotFTC5037,项目名称:BlockParty2015,代码行数:58,代码来源:holonomicAuto_V2r1.c

示例13: BasketStateMachine

//Atomatic controlling of the basket servo & sweeper
void BasketStateMachine()
{
	static int state=CLOSED;

	if(state==CLOSED &&
		 time1[T1]>=SERVOTIME &&
		(SensorValue[touchSensor]==1 || joy2Btn(BASKETDOWNBUTTON)==true))
	{
		motor[sweeper]=-sweeperOn;
		sweeperEnabled=false;
		servo[basketServo]=basketServoDown;
		ClearTimer(T1);
		armEnabled=false;

		state=OPENING;
	}
	else if(state==OPENING && time1[T1]>=SERVOTIME)
	{
		motor[sweeper]=off;
		sweeperEnabled=true;

		state=OPEN;
	}
	else if(state==OPEN && (ARMJOYSTICK>deadZone || joy2Btn(BASKETUPBUTTON)==true))
	{
		motor[sweeper]=sweeperOn;
		sweeperEnabled=false;
		servo[basketServo]=basketServoUp;
		ClearTimer(T1);

		state=CLOSING;
	}
	else if(state==CLOSING && time1[T1]>=SERVOTIME)
	{
		motor[sweeper]=off;
		sweeperEnabled=true;
		armEnabled=true;
		ClearTimer(T1);

		state=CLOSED;
	}
}
开发者ID:FRC967,项目名称:linn-mar-robotics,代码行数:43,代码来源:4324_Teleop_state_function_OGE_Comments_11_5_13.bak.c

示例14: raiseLift

void raiseLift()
{
	ClearTimer(T1);
	while(abs(nMotorEncoder[elevator]) < 8000 && time1[T1] <2500)
	{
		motor[elevator] = 100;
		print(nMotorEncoder[elevator],4);
		PlaySound(soundBlip);
	}
	motor[elevator] = 0;
}
开发者ID:GhostRobotics,项目名称:7876,代码行数:11,代码来源:Auto_Ramp_1.1.c

示例15: getaccel

task getaccel()
{
	while(true)
	{
		ClearTimer(T1);
		HTACreadAllAxes(Accel, X_axis, Y_axis, Z_axis);
		X_axis = X_axis - offset_X;
		wait10Msec(1);
		X_axis_old = X_axis;
	}
}
开发者ID:phi-robotics-team,项目名称:phi_robotics,代码行数:11,代码来源:accel+to+dist.c


注:本文中的ClearTimer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。