Zumo32U4 library
Zumo32U4LineSensors.h
Go to the documentation of this file.
1 
3 #pragma once
4 
5 #include <QTRSensors.h>
6 
9 static const uint8_t SENSOR_DOWN1 = 18;
10 
13 static const uint8_t SENSOR_DOWN2 = 20;
14 
17 static const uint8_t SENSOR_DOWN3 = 21;
18 
21 static const uint8_t SENSOR_DOWN4 = 4;
22 
25 static const uint8_t SENSOR_DOWN5 = 12;
26 
29 static const uint8_t SENSOR_LEDON = 11;
30 
44 {
45 public:
46 
54 
58  Zumo32U4LineSensors(uint8_t * pins, uint8_t numSensors,
59  uint8_t emitterPin = SENSOR_LEDON)
60  {
61  init(pins, numSensors, emitterPin);
62  }
63 
68  void initThreeSensors(uint8_t emitterPin = SENSOR_LEDON)
69  {
70  uint8_t pins[] = { SENSOR_DOWN1, SENSOR_DOWN3, SENSOR_DOWN5 };
71  init(pins, sizeof(pins), 2000, emitterPin);
72  }
73 
80  void initFiveSensors(uint8_t emitterPin = SENSOR_LEDON)
81  {
82  uint8_t pins[] = { SENSOR_DOWN1, SENSOR_DOWN2, SENSOR_DOWN3,
84  init(pins, sizeof(pins), 2000, emitterPin);
85  }
86 
97  void init(uint8_t * pins, uint8_t numSensors,
98  uint16_t timeout = 2000, uint8_t emitterPin = SENSOR_LEDON)
99  {
100  QTRSensorsRC::init(pins, numSensors, timeout, emitterPin);
101  }
102 };
103 
static const uint8_t SENSOR_DOWN3
The pin number for standard pin that is used to read line sensor 3, the middle sensor.
static const uint8_t SENSOR_DOWN4
The pin number for the standard pin that is used to read line sensor 4, the sensor second from the ri...
static const uint8_t SENSOR_DOWN5
The pin number for the standard pin that is used to read line sensor 5, the right-most sensor.
static const uint8_t SENSOR_LEDON
The pin number for the standard pin that is used to enable or disable the IR emitters of the line sen...
static const uint8_t SENSOR_DOWN1
The pin number for the standard pin that is used to read line sensor 1, the left-most sensor.
static const uint8_t SENSOR_DOWN2
The pin number for the standard pin that is used to read line sensor 2, the sensor second from the le...
Gets readings from the five down-facing line sensors on the front sensor array.
void initFiveSensors(uint8_t emitterPin=SENSOR_LEDON)
Configures this object to use all five line sensors.
Zumo32U4LineSensors(uint8_t *pins, uint8_t numSensors, uint8_t emitterPin=SENSOR_LEDON)
Constructor that takes pin arguments.
void initThreeSensors(uint8_t emitterPin=SENSOR_LEDON)
Configures this object to use just three line sensors.
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.
Zumo32U4LineSensors()
Minimal constructor.