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

📄 accelerometer.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 ACCELEROMETER_H_
#define ACCELEROMETER_H_

#include "AnalogChannel.h"
#include "SensorBase.h"
#include "PIDSource.h"

/** 
 * Handle operation of the accelerometer.
 * The accelerometer reads acceleration directly through the sensor. Many sensors have
 * multiple axis and can be treated as multiple devices. Each is calibrated by finding
 * the center value over a period of time.
 */
class Accelerometer : public SensorBase, public PIDSource {
public:
	explicit Accelerometer(UINT32 channel);
	Accelerometer(UINT32 slot, UINT32 channel);
	explicit Accelerometer(AnalogChannel *channel);
	virtual ~Accelerometer();

	float GetAcceleration();
	void SetSensitivity(float sensitivity);
	void SetZero(float zero);
	double PIDGet();

private:
	void InitAccelerometer();

	AnalogChannel *m_analogChannel;
	float m_voltsPerG;
	float m_zeroGVoltage;
	bool m_allocatedChannel;
};

#endif

⌨️ 快捷键说明

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