本文整理汇总了C++中Sensor::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ Sensor::getType方法的具体用法?C++ Sensor::getType怎么用?C++ Sensor::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sensor
的用法示例。
在下文中一共展示了Sensor::getType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mSensorDevice
SensorFusion::SensorFusion()
: mSensorDevice(SensorDevice::getInstance()),
mEnabled(false), mGyroTime(0)
{
sensor_t const* list;
Sensor uncalibratedGyro;
ssize_t count = mSensorDevice.getSensorList(&list);
if (count > 0) {
for (size_t i=0 ; i<size_t(count) ; i++) {
if (list[i].type == SENSOR_TYPE_ACCELEROMETER) {
mAcc = Sensor(list + i);
}
if (list[i].type == SENSOR_TYPE_MAGNETIC_FIELD) {
mMag = Sensor(list + i);
}
if (list[i].type == SENSOR_TYPE_GYROSCOPE) {
mGyro = Sensor(list + i);
}
if (list[i].type == SENSOR_TYPE_GYROSCOPE_UNCALIBRATED) {
uncalibratedGyro = Sensor(list + i);
}
}
// Use the uncalibrated gyroscope for sensor fusion when available
if (uncalibratedGyro.getType() == SENSOR_TYPE_GYROSCOPE_UNCALIBRATED) {
mGyro = uncalibratedGyro;
}
// 200 Hz for gyro events is a good compromise between precision
// and power/cpu usage.
mEstimatedGyroRate = 200;
mTargetDelayNs = 1000000000LL/mEstimatedGyroRate;
mFusion.init();
}
}
示例2: getAllSensors
void GUIServer::getAllSensors() {
//errorcode 0
m_UdpServer.write((uint8_t) 0);
//num of sensors
m_UdpServer.write((uint8_t) __aquaduino->getNrOfSensors());
//Serial.println("NrOfSensors()");
// Serial.println(__aquaduino->getNrOfSensors());
//sensor information
Sensor* sensor;
__aquaduino->resetSensorIterator();
while (__aquaduino->getNextSensor(&sensor) != -1) {
m_UdpServer.write(__aquaduino->getSensorID(sensor));
//Name:String
m_UdpServer.write(strlen(sensor->getName()));
m_UdpServer.write(sensor->getName());
//Type:int
m_UdpServer.write(sensor->getType());
//Unit:String
m_UdpServer.write((uint8_t) 8);
m_UdpServer.write("TestUnit");
//visible:Boolean
m_UdpServer.write(true);
//calibrationInterval(days):int
m_UdpServer.write((uint8_t) 0);
}
}
示例3: read
/**
* \brief Returns the value of the digital input
*
* \returns 1 if input is HIGH or 0 if input is LOW.
*/
double SerialAtlasEC::read()
{
Sensor* sensor;
// Serial.println("EC");
// Serial.println(actualEC);
// init Sensor
if (initCounter < 10000)
initCounter++;
if (initCounter == 10000)
{
__aquaduino->resetSensorIterator();
while (__aquaduino->getNextSensor(&sensor) != -1)
{
if (sensor->getType() == SENSOR_DS18S20)
{
tempSensorID=__aquaduino->getSensorID(sensor);
}
}
Serial1.print("25.00,C\r");
Serial.println("EC set to send continuous data");
initCounter++;
}
//set Temperature every Minute
if (minute() != curMin)
{
curMin = minute();
Serial.print(__aquaduino->getSensorValue(tempSensorID));
Serial.println((" Set new Temperature to EC"));
Serial1.print(__aquaduino->getSensorValue(tempSensorID));
Serial1.print(",C\r");
}
return actualEC;
}
示例4: getType
// get the type of this feature
int getType() { return sensor->getType(); }