133 init(pins, numSensors, lineSensorEmitterPin);
153 init(defaultPins,
sizeof(defaultPins), lineSensorEmitterPin);
170 init(pins,
sizeof(pins), lineSensorEmitterPin);
182 void init(uint8_t * pins, uint8_t numSensors,
253 this->period = period;
280 this->pulseOnTimeUs = pulseOnTimeUs;
291 this->pulseOffTimeUs = pulseOffTimeUs;
496 void prepareToRead();
497 uint8_t findIndexForPin(uint8_t pin)
const;
499 typedef struct SensorData
502 uint8_t withLeftLeds;
503 uint8_t withRightLeds;
506 SensorData * dataArray;
509 uint8_t lineSensorEmitterPin;
511 uint16_t * levelsArray;
515 uint16_t pulseOnTimeUs;
516 uint16_t pulseOffTimeUs;
static const uint8_t SENSOR_LEFT
The pin number for the standard pin that is used to read the left proximity sensor.
static const uint8_t SENSOR_FRONT
The pin number for the standard pin that is used to read the front proximity sensor.
static const uint8_t SENSOR_NO_PIN
A constant that can be used in place of a pin number to indicate that no pin should be used.
static const uint8_t SENSOR_RIGHT
The pin number for the standard pin that is used to read the right proximity sensor.
Gets readings from the three proximity sensors on the front sensor array.
void read()
Emits IR pulses and gets readings from the sensors.
static const uint16_t defaultPeriod
The default period for the infrared pulses.
Zumo32U4ProximitySensors(uint8_t *pins, uint8_t numSensors, uint8_t lineSensorEmitterPin=defaultLineSensorEmitterPin)
Constructor that takes pin arguments.
void init(uint8_t *pins, uint8_t numSensors, uint8_t lineSensorEmitterPin=defaultLineSensorEmitterPin)
Configures this object to use a custom set of pins.
uint8_t countsWithRightLeds(uint8_t sensorNumber) const
Returns the number of brightness levels for the right LEDs that activated the specified sensor.
uint8_t countsRightWithRightLeds() const
Returns the number of brightness levels for the right LEDs that activated the right proximity sensor.
void setBrightnessLevels(uint16_t *levels, uint8_t levelCount)
Sets the sequence of brightness levels used by read().
void setPulseOffTimeUs(uint16_t pulseOffTimeUs)
Sets the amount of time, in microseconds, that the read() function will leave the pulses off before g...
void initThreeSensors(uint8_t lineSensorEmitterPin=defaultLineSensorEmitterPin)
Configures this object to use all three proximity sensors.
void lineSensorEmittersOff()
Turns the IR emitters for the line sensors off.
bool readBasic(uint8_t sensorNumber)
Does a quick digital reading of the specified sensor without emitting any IR pulses.
static const uint16_t defaultPulseOffTimeUs
The default time to leave the infrared LEDs off between readings, in microseconds.
bool readBasicFront()
Does a quick digital reading of the front sensor.
static const uint16_t defaultPulseOnTimeUs
The default duration of the bursts of infrared pulses emitted, in microseconds.
uint8_t countsFrontWithRightLeds() const
Returns the number of brightness levels for the right LEDs that activated the front proximity sensor.
bool readBasicRight()
Does a quick digital reading of the right sensor.
uint8_t countsWithLeftLeds(uint8_t sensorNumber) const
Returns the number of brightness levels for the left LEDs that activated the specified sensor.
Zumo32U4ProximitySensors()
Minimal constructor.
static const uint8_t defaultLineSensorEmitterPin
The default line sensor emitter pin.
bool readBasicLeft()
Does a quick digital reading of the left sensor.
uint8_t countsFrontWithLeftLeds() const
Returns the number of brightness levels for the left LEDs that activated the front proximity sensor.
uint8_t countsRightWithLeftLeds() const
Returns the number of brightness levels for the left LEDs that activated the right proximity sensor.
uint8_t countsLeftWithRightLeds() const
Returns the number of brightness levels for the right LEDs that activated the left proximity sensor.
void setPeriod(uint16_t period)
Sets the period used for the IR pulses.
uint8_t getNumBrightnessLevels() const
Returns the number of brightness levels.
void initFrontSensor(uint8_t lineSensorEmitterPin=defaultLineSensorEmitterPin)
Configures this object to use just the front proximity sensor.
uint8_t getNumSensors() const
Returns the number of sensors.
uint8_t countsLeftWithLeftLeds() const
Returns the number of brightness levels for the left LEDs that activated the left proximity sensor.
void pullupsOn()
Sets each sensor pin to an input with pull-up resistors enabled.
void setPulseOnTimeUs(uint16_t pulseOnTimeUs)
Sets the duration, in microseconds, for each burst of IR pulses emitted by the read() function.