Pololu Zumo Shield Arduino Library
ZumoReflectanceSensorArray.h
Go to the documentation of this file.
1 
78 #ifndef ZumoReflectanceSensorArray_h
79 #define ZumoReflectanceSensorArray_h
80 
81 #include <QTRSensors.h>
82 #include <Arduino.h>
83 
84 #if defined(__AVR_ATmega32U4__)
85  // Arduino Leonardo
86  #define ZUMO_SENSOR_ARRAY_DEFAULT_EMITTER_PIN A4
87 #else
88  // Arduino UNO and other ATmega328P/168 Arduinos
89  #define ZUMO_SENSOR_ARRAY_DEFAULT_EMITTER_PIN 2
90 #endif
91 
93 {
94  public:
95 
102 
111  ZumoReflectanceSensorArray(unsigned char emitterPin)
112  {
113  init(emitterPin);
114  }
115 
127  ZumoReflectanceSensorArray(unsigned char * pins, unsigned char numSensors, unsigned int timeout = 2000,
128  unsigned char emitterPin = ZUMO_SENSOR_ARRAY_DEFAULT_EMITTER_PIN)
129  {
130  QTRSensorsRC::init(pins, numSensors, timeout, emitterPin);
131  }
132 
153  void init(unsigned char emitterPin = ZUMO_SENSOR_ARRAY_DEFAULT_EMITTER_PIN)
154  {
155  unsigned char sensorPins[] = { 4, A3, 11, A0, A2, 5 };
156  QTRSensorsRC::init(sensorPins, sizeof(sensorPins), 2000, emitterPin);
157  }
158 
220  void init(unsigned char * pins, unsigned char numSensors, unsigned int timeout = 2000,
221  unsigned char emitterPin = ZUMO_SENSOR_ARRAY_DEFAULT_EMITTER_PIN)
222  {
223  QTRSensorsRC::init(pins, numSensors, timeout, emitterPin);
224  }
225 };
226 
227 // documentation for inherited functions
228 
378 // documentation for inherited member variables
379 
411 #endif
ZumoReflectanceSensorArray::ZumoReflectanceSensorArray
ZumoReflectanceSensorArray()
Minimal constructor.
Definition: ZumoReflectanceSensorArray.h:101
ZumoReflectanceSensorArray::init
void init(unsigned char *pins, unsigned char numSensors, unsigned int timeout=2000, unsigned char emitterPin=ZUMO_SENSOR_ARRAY_DEFAULT_EMITTER_PIN)
Initializes with all settings as given.
Definition: ZumoReflectanceSensorArray.h:220
ZumoReflectanceSensorArray::init
void init(unsigned char emitterPin=ZUMO_SENSOR_ARRAY_DEFAULT_EMITTER_PIN)
Initializes with given emitter pin and and defaults for other settings.
Definition: ZumoReflectanceSensorArray.h:153
ZumoReflectanceSensorArray::ZumoReflectanceSensorArray
ZumoReflectanceSensorArray(unsigned char emitterPin)
Constructor; initializes with given emitter pin and defaults for other settings.
Definition: ZumoReflectanceSensorArray.h:111
ZumoReflectanceSensorArray::ZumoReflectanceSensorArray
ZumoReflectanceSensorArray(unsigned char *pins, unsigned char numSensors, unsigned int timeout=2000, unsigned char emitterPin=ZUMO_SENSOR_ARRAY_DEFAULT_EMITTER_PIN)
Constructor; initializes with all settings as given.
Definition: ZumoReflectanceSensorArray.h:127
QTRSensorsRC
Definition: QTRSensors.h:162
ZumoReflectanceSensorArray
Read from reflectance sensor array.
Definition: ZumoReflectanceSensorArray.h:93