⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 servo.h

📁 good luck to everyone!
💻 H
字号:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.							  */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */
/*----------------------------------------------------------------------------*/

#ifndef SERVO_H
#define SERVO_H

#include "PWM.h"
#include "SpeedController.h"

/**
 * Standard hobby style servo.
 * 
 * The range parameters default to the appropriate values for the Hitec HS-322HD servo provided
 * in the FIRST Kit of Parts in 2008.
 */
class Servo : public PWM, public SpeedController
{
public:
	explicit Servo(UINT32 channel);
	Servo(UINT32 slot, UINT32 channel);
	virtual ~Servo();
	void Set(float value);
	float Get();
	void SetAngle(float angle);
	float GetAngle();
	static float GetMaxAngle() { return kMaxServoAngle; };
	static float GetMinAngle() { return kMinServoAngle; };

private:
	void InitServo();
	float GetServoAngleRange() {return kMaxServoAngle - kMinServoAngle;}

	static const float kMaxServoAngle = 170.0;
	static const float kMinServoAngle = 0.0;
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -