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

◆ calibrate()

void QTRSensors::calibrate ( unsigned char  readMode = QTR_EMITTERS_ON)
inherited

Definition at line 149 of file QTRSensors.cpp.

◆ emittersOff()

void QTRSensors::emittersOff ( )
inherited

Definition at line 110 of file QTRSensors.cpp.

◆ emittersOn()

void QTRSensors::emittersOn ( )
inherited

Definition at line 119 of file QTRSensors.cpp.

◆ init() [1/3]

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.

◆ init() [2/3]

void QTRSensors::init ( unsigned char *  pins,
unsigned char  numSensors,
unsigned char  emitterPin 
)
protectedinherited

Definition at line 41 of file QTRSensors.cpp.

◆ init() [3/3]

void QTRSensorsRC::init ( unsigned char *  pins,
unsigned char  numSensors,
unsigned int  timeout = 2000,
unsigned char  emitterPin = QTR_NO_EMITTER_PIN 
)
inherited

Definition at line 407 of file QTRSensors.cpp.

◆ 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.

◆ read()

void QTRSensors::read ( unsigned int *  sensor_values,
unsigned char  readMode = QTR_EMITTERS_ON 
)
inherited

Definition at line 81 of file QTRSensors.cpp.

◆ readCalibrated()

void QTRSensors::readCalibrated ( unsigned int *  sensor_values,
unsigned char  readMode = QTR_EMITTERS_ON 
)
inherited

Definition at line 235 of file QTRSensors.cpp.

◆ readLine()

int QTRSensors::readLine ( unsigned int *  sensor_values,
unsigned char  readMode = QTR_EMITTERS_ON,
unsigned char  white_line = 0 
)
inherited

Definition at line 315 of file QTRSensors.cpp.

◆ resetCalibration()

void QTRSensors::resetCalibration ( )
inherited

Definition at line 129 of file QTRSensors.cpp.

Member Data Documentation

◆ _emitterPin

unsigned char QTRSensors::_emitterPin
protectedinherited

Definition at line 142 of file QTRSensors.h.

◆ _lastValue

int QTRSensors::_lastValue
protectedinherited

Definition at line 144 of file QTRSensors.h.

◆ _maxValue

unsigned int QTRSensors::_maxValue
protectedinherited

Definition at line 143 of file QTRSensors.h.

◆ _numSensors

unsigned char QTRSensors::_numSensors
protectedinherited

Definition at line 141 of file QTRSensors.h.

◆ _pins

unsigned char* QTRSensors::_pins
protectedinherited

Definition at line 140 of file QTRSensors.h.

◆ calibratedMaximumOff

unsigned int* QTRSensors::calibratedMaximumOff
inherited

Definition at line 127 of file QTRSensors.h.

◆ calibratedMaximumOn

unsigned int* QTRSensors::calibratedMaximumOn
inherited

Definition at line 125 of file QTRSensors.h.

◆ calibratedMinimumOff

unsigned int* QTRSensors::calibratedMinimumOff
inherited

Definition at line 126 of file QTRSensors.h.

◆ calibratedMinimumOn

unsigned int* QTRSensors::calibratedMinimumOn
inherited

Definition at line 124 of file QTRSensors.h.


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