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


C++ AnalogChannel::GetAverageVoltage方法代码示例

本文整理汇总了C++中AnalogChannel::GetAverageVoltage方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalogChannel::GetAverageVoltage方法的具体用法?C++ AnalogChannel::GetAverageVoltage怎么用?C++ AnalogChannel::GetAverageVoltage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AnalogChannel的用法示例。


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

示例1: OperatorControl

	void OperatorControl(void)
	{
		NetTest();
		return;
		myRobot.SetSafetyEnabled(true);
		digEncoder.Start();
		const double ppsTOrpm = 60.0/250.0;   //Convert from Pos per Second to Rotations per Minute by multiplication
                                              // (See the second number on the back of the encoder to replace 250 for different encoders)
        const float VoltsToIn = 41.0;         // Convert from volts to cm by multiplication (volts from ultrasonic).
                                              // This value worked for distances between 1' and 10'.
		
		while (IsOperatorControl())
		{
			if (stick.GetRawButton(4)) {
				myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), -1);
			} 
			else if (stick.GetRawButton(5))
			{
				myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), 1);
			}
			else 
			{
				myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), 0);
			}
			
			myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), 0);
			
			SmartDashboard::PutNumber("Digital Encoder RPM", abs(digEncoder.GetRate()*ppsTOrpm));
			SmartDashboard::PutNumber("Ultrasonic Distance inch", (double) ultra.GetAverageVoltage()*VoltsPerInch);
			SmartDashboard::PutNumber("Ultrasonic Voltage", (double) ultra.GetAverageVoltage());

			Wait(0.1);
		}
		digEncoder.Stop();
	}
开发者ID:Techbrick,项目名称:MainWorkingCode,代码行数:35,代码来源:MyRobot.cpp

示例2: GetAnalogAverageVoltage

/**
 * Get a scaled sample from the output of the oversample and average engine for this channel.
 * The value is scaled to units of Volts using the calibrated scaling data from GetLSBWeight() and GetOffset().
 * Using oversampling will cause this value to be higher resolution, but it will update more slowly.
 * Using averaging will cause this value to be more stable, but it will update more slowly.

 * @param channel The channel in the module assicated with this analog channel
 * @return A scaled sample from the output of the oversample and average engine for this channel.
 */
float GetAnalogAverageVoltage(UINT32 channel)
{
	AnalogChannel *analog = AllocateAnalogChannel(AnalogModule::GetDefaultAnalogModule(), channel);
	if (analog != NULL)
	{
		return analog->GetAverageVoltage();
	}
	return 0.0;
}
开发者ID:Techbrick,项目名称:MainWorkingCode,代码行数:18,代码来源:CAnalogChannel.cpp

示例3: CalibrateEnd

 void CalibrateEnd()
 {
     max = pot.GetAverageVoltage();
 }
开发者ID:Numeri,项目名称:Shooter,代码行数:4,代码来源:Potentiometer.cpp

示例4: CalibrateStart

 void CalibrateStart()
 {
     min = pot.GetAverageVoltage();
 }
开发者ID:Numeri,项目名称:Shooter,代码行数:4,代码来源:Potentiometer.cpp

示例5: Get

 float Get()
 {
     return (pot.GetAverageVoltage() - min)/(max - min);
 }
开发者ID:Numeri,项目名称:Shooter,代码行数:4,代码来源:Potentiometer.cpp


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