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