Zumo32U4 library
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Zumo32U4LineSensors Class Reference

Gets readings from the five down-facing line sensors on the front sensor array. More...

#include <Zumo32U4LineSensors.h>

Inheritance diagram for Zumo32U4LineSensors:
QTRSensorsRC QTRSensors

Public Member Functions

 Zumo32U4LineSensors ()
 Minimal constructor. More...
 
 Zumo32U4LineSensors (uint8_t *pins, uint8_t numSensors, uint8_t emitterPin=SENSOR_LEDON)
 Constructor that takes pin arguments. More...
 
void initThreeSensors (uint8_t emitterPin=SENSOR_LEDON)
 Configures this object to use just three line sensors. More...
 
void initFiveSensors (uint8_t emitterPin=SENSOR_LEDON)
 Configures this object to use all five line sensors. More...
 
void init (uint8_t *pins, uint8_t numSensors, uint16_t timeout=2000, uint8_t emitterPin=SENSOR_LEDON)
 Configures this object to use a custom set of pins. More...
 
void init (unsigned char *pins, unsigned char numSensors, unsigned int timeout=2000, unsigned char emitterPin=QTR_NO_EMITTER_PIN)
 
void read (unsigned int *sensor_values, unsigned char readMode=QTR_EMITTERS_ON)
 
void emittersOff ()
 
void emittersOn ()
 
void calibrate (unsigned char readMode=QTR_EMITTERS_ON)
 
void resetCalibration ()
 
void readCalibrated (unsigned int *sensor_values, unsigned char readMode=QTR_EMITTERS_ON)
 
int readLine (unsigned int *sensor_values, unsigned char readMode=QTR_EMITTERS_ON, unsigned char white_line=0)
 

Public Attributes

unsigned int * calibratedMinimumOn
 
unsigned int * calibratedMaximumOn
 
unsigned int * calibratedMinimumOff
 
unsigned int * calibratedMaximumOff
 

Protected Member Functions

void init (unsigned char *pins, unsigned char numSensors, unsigned char emitterPin)
 

Protected Attributes

unsigned char * _pins
 
unsigned char _numSensors
 
unsigned char _emitterPin
 
unsigned int _maxValue
 
int _lastValue
 

Detailed Description

Gets readings from the five down-facing line sensors on the front sensor array.

The functions that this class inherits from QTRSensorsRC, such as read() and calibrate(), are documented in the user's guide for the QTRSensors library. QTRSensors is a separate Arduino library with a separate GitHub repository, but we include a copy of it in the Zumo32U4 library since it is needed for the Zumo32U4LineSensors class.

Definition at line 43 of file Zumo32U4LineSensors.h.

Constructor & Destructor Documentation

◆ Zumo32U4LineSensors() [1/2]

Zumo32U4LineSensors::Zumo32U4LineSensors ( )
inline

Minimal constructor.

If you use this (i.e. by not providing any arguments when you create the Zumo32U4ProximitySensors object), then you will have to call initThreeSensors(), initFiveSensors(), or init() before using the functions in this class.

Definition at line 53 of file Zumo32U4LineSensors.h.

◆ Zumo32U4LineSensors() [2/2]

Zumo32U4LineSensors::Zumo32U4LineSensors ( uint8_t *  pins,
uint8_t  numSensors,
uint8_t  emitterPin = SENSOR_LEDON 
)
inline

Constructor that takes pin arguments.

This constructor calls init() with the specified arguments.

Definition at line 58 of file Zumo32U4LineSensors.h.

Member Function Documentation

◆ init()

void Zumo32U4LineSensors::init ( uint8_t *  pins,
uint8_t  numSensors,
uint16_t  timeout = 2000,
uint8_t  emitterPin = SENSOR_LEDON 
)
inline

Configures this object to use a custom set of pins.

Parameters
pinsA pointer to an array with the pin numbers for the sensors.
numSensorsThe number of sensors.
timeoutSpecifies the length of time in microseconds beyond which you consider the sensor reading completely black.
emitterPinThe number of the pin that controls the emitters for the line sensors. You can specify a value of QTR_NO_EMITTER_PIN for this parameter if you want this object to not do anything to the emitters.

Definition at line 97 of file Zumo32U4LineSensors.h.

◆ initFiveSensors()

void Zumo32U4LineSensors::initFiveSensors ( uint8_t  emitterPin = SENSOR_LEDON)
inline

Configures this object to use all five line sensors.

This function configures this object to use all five line sensors.

For this configuration to work, jumpers on the front sensor array must be installed in order to connect pin 20 to DN2 and connect pin 4 to DN4.

Definition at line 80 of file Zumo32U4LineSensors.h.

◆ initThreeSensors()

void Zumo32U4LineSensors::initThreeSensors ( uint8_t  emitterPin = SENSOR_LEDON)
inline

Configures this object to use just three line sensors.

This function configures this object to just use line sensors 1, 3, and

Definition at line 68 of file Zumo32U4LineSensors.h.


The documentation for this class was generated from the following file: