Balboa32U4 library
Classes | Enumerations | Variables
QTRSensors.h File Reference
#include <stdint.h>

Go to the source code of this file.

Classes

class  QTRSensors
 Represents a QTR sensor array. More...
 
struct  QTRSensors::CalibrationData
 Stores sensor calibration data. More...
 

Enumerations

enum  QTRReadMode : uint8_t {
  QTRReadMode::Off, QTRReadMode::On, QTRReadMode::OnAndOff, QTRReadMode::OddEven,
  QTRReadMode::OddEvenAndOff, QTRReadMode::Manual
}
 Emitter behavior when taking readings. More...
 
enum  QTRType : uint8_t { Undefined, RC, Analog }
 Sensor types.
 
enum  QTREmitters : uint8_t { All, Odd, Even, None }
 Emitters selected to turn on or off.
 

Variables

const uint8_t QTRNoEmitterPin = 255
 Represents an undefined emitter control pin.
 
const uint16_t QTRRCDefaultTimeout = 2500
 Default timeout for RC sensors (in microseconds).
 
const uint8_t QTRMaxSensors = 31
 The maximum number of sensors supported by an instance of this class.
 

Enumeration Type Documentation

◆ QTRReadMode

enum QTRReadMode : uint8_t
strong

Emitter behavior when taking readings.

Note that emitter control will only work if you specify a valid emitter pin with setEmitterPin(), and the odd/even modes will only work if you are using a second-generation QTR or QTRX sensor with two emitter control pins and you specify both pins with setEmitterPins().

Enumerator
Off 

Each reading is made without turning on the infrared (IR) emitters. The reading represents ambient light levels near the sensor.

On 

Each reading is made with the emitters on. The reading is a measure of reflectance.

OnAndOff 

For each sensor, a reading is made in both the on and off states. The value returned is on + max − off, where on and off are the reading with the emitters on and off, respectively, and max is the maximum possible sensor reading. This mode can reduce the amount of interference from uneven ambient lighting.

OddEven 

The odd-numbered sensors are read with the odd-numbered emitters on, then the even-numbered sensors are read with the even-numbered emitters on. This mode can reduce interference between adjacent sensors, especially on QTRX sensor boards. It is only usable with second-generation QTR and QTRX sensor arrays that have two emitter control pins.

OddEvenAndOff 

The odd and even sensors are read separately with the respective emitters on, then all sensors are read with emitters off and on + max − off is returned. (In other words, this mode combines OddEven and OnAndOff.)

Manual 

Calling read() with this mode prevents it from automatically controlling the emitters: they are left in their existing states, which allows manual control of the emitters for testing and advanced use. Calibrating and obtaining calibrated readings are not supported with this mode.

Definition at line 13 of file QTRSensors.h.