本文整理汇总了C++中Counter::GetPeriod方法的典型用法代码示例。如果您正苦于以下问题:C++ Counter::GetPeriod方法的具体用法?C++ Counter::GetPeriod怎么用?C++ Counter::GetPeriod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Counter
的用法示例。
在下文中一共展示了Counter::GetPeriod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAcceleration
void GetAcceleration(double &ax, double &ay)
{
double axH = countXhi.GetPeriod();
double axL = countXlow.GetPeriod();
double ayH = countYhi.GetPeriod();
double ayL = countYlow.GetPeriod();
//axH = axH - fmod(axH, 0.00001);
//ayH = ayH - fmod(ayH, 0.00001);
// convert to m/s^2 -- 50% duty cycle is 0g
ax = (((axH / (axH + axL)) - .5) * 8.0) * 9.81;
ay = (((ayH / (ayH + ayL)) - .5) * 8.0) * 9.81;
}
示例2: GetCounterPeriod
/*
* Get the Period of the most recent count.
* Returns the time interval of the most recent count. This can be used for velocity calculations
* to determine shaft speed.
* @param channel The channel of the digital input used with this counter
* @returns The period of the last two pulses in units of seconds.
*/
double GetCounterPeriod(UINT32 channel)
{
Counter *counter = AllocateCounter(channel);
if (counter != NULL)
return counter->GetPeriod();
else
return 0;
}