Go to the documentation of this file.
135 void setSensorPins(
const uint8_t * pins, uint8_t sensorCount);
219 void setEmitterPins(uint8_t oddEmitterPin, uint8_t evenEmitterPin);
496 return readLinePrivate(sensorValues, mode,
false);
519 return readLinePrivate(sensorValues, mode,
true);
555 uint16_t emittersOnWithPin(uint8_t pin);
561 void readPrivate(uint16_t * sensorValues, uint8_t start = 0, uint8_t step = 1);
563 uint16_t readLinePrivate(uint16_t * sensorValues,
QTRReadMode mode,
bool invertReadings);
565 QTRType _type = QTRType::Undefined;
567 uint8_t * _sensorPins =
nullptr;
568 uint8_t _sensorCount = 0;
572 uint8_t _samplesPerSensor = 4;
576 uint8_t _emitterPinCount = 0;
578 bool _dimmable =
true;
579 uint8_t _dimmingLevel = 0;
581 uint16_t _lastPosition = 0;
void setNonDimmable()
Specifies that the sensors are non-dimmable.
Represents a QTR sensor array.
void emittersOff(QTREmitters emitters=QTREmitters::All, bool wait=true)
Turns the IR LEDs off.
void setEmitterPins(uint8_t oddEmitterPin, uint8_t evenEmitterPin)
Sets separate odd and even emitter control pins for the sensors.
uint8_t getEvenEmitterPin()
Returns the even emitter control pin.
void emittersSelect(QTREmitters emitters)
Turns on the selected emitters and turns off the other emitters with optimized timing.
void readCalibrated(uint16_t *sensorValues, QTRReadMode mode=QTRReadMode::On)
Reads the sensors and provides calibrated values between 0 and 1000.
uint8_t getEmitterPinCount()
Returns the number of emitter control pins in use.
uint16_t getSamplesPerSensor()
Returns the number of analog readings to average per analog sensor.
uint16_t * maximum
Highest readings seen during calibration.
void setEmitterPin(uint8_t emitterPin)
Sets the emitter control pin for the sensors.
void releaseEmitterPins()
Releases emitter pin/pins that have been set.
uint8_t getEmitterPin()
Returns the emitter control pin.
void setSamplesPerSensor(uint8_t samples)
Sets the number of analog readings to average per analog sensor.
void setSensorPins(const uint8_t *pins, uint8_t sensorCount)
Sets the sensor pins.
const uint8_t QTRNoEmitterPin
Represents an undefined emitter control pin.
void setTypeRC()
Specifies that the sensors are RC.
void setDimmable()
Specifies that the sensors are dimmable.
void resetCalibration()
Resets all calibration that has been done.
uint16_t getTimeout()
Returns the timeout for RC sensors.
CalibrationData calibrationOn
Data from calibrating with emitters on.
CalibrationData calibrationOff
Data from calibrating with emitters off.
Stores sensor calibration data.
uint8_t getDimmingLevel()
Returns the dimming level.
bool getDimmable()
Returns whether the sensors are dimmable.
void calibrate(QTRReadMode mode=QTRReadMode::On)
Reads the sensors for calibration.
QTRReadMode
Emitter behavior when taking readings.
uint16_t readLineWhite(uint16_t *sensorValues, QTRReadMode mode=QTRReadMode::On)
Reads the sensors, provides calibrated values, and returns an estimated white line position.
QTREmitters
Emitters selected to turn on or off.
void emittersOn(QTREmitters emitters=QTREmitters::All, bool wait=true)
Turns the IR LEDs on.
uint8_t getOddEmitterPin()
Returns the odd emitter control pin.
void setTypeAnalog(uint16_t maxVal=1023)
Specifies that the sensor type is analog.
const uint8_t QTRMaxSensors
The maximum number of sensors supported by an instance of this class.
void read(uint16_t *sensorValues, QTRReadMode mode=QTRReadMode::On)
Reads the raw sensor values into an array.
bool initialized
Whether array pointers have been allocated and initialized.
const uint16_t QTRRCDefaultTimeout
Default timeout for RC sensors (in microseconds).
QTRType getType()
Returns the type of the sensors.
uint16_t * minimum
Lowest readings seen during calibration.
uint16_t readLineBlack(uint16_t *sensorValues, QTRReadMode mode=QTRReadMode::On)
Reads the sensors, provides calibrated values, and returns an estimated black line position.
void setDimmingLevel(uint8_t dimmingLevel)
Sets the dimming level.
void setTimeout(uint16_t timeout)
Sets the timeout for RC sensors.