Zumo32U4 library
|
Emits pulses of infrared (IR) light using the IR LEDs on the Zumo 32U4 Main Board. More...
#include <Zumo32U4IRPulses.h>
Public Types | |
enum | Direction { Left = 0 , Right = 1 } |
Static Public Member Functions | |
static void | start (Direction direction, uint16_t brightness, uint16_t period=defaultPeriod) |
Starts emitting IR pulses. More... | |
static void | stop () |
Stops emitting IR pulses. More... | |
Static Public Attributes | |
static const uint16_t | defaultPeriod = 420 |
Emits pulses of infrared (IR) light using the IR LEDs on the Zumo 32U4 Main Board.
Timer 3 is used to generate a PWM signal, so this library might conflict with other libraries that use Timer 3. When the pulses are stopped, Timer 3 can be used for other purposes.
Pin A1 (PF6) is used to select which set of LEDs to turn on: the left-side LEDs or the right-side LEDs.
Pin 5 (PC6/OC3A) is used as a PWM output to turn the LEDs on and off.
This class does not do anything with the IR LEDs or detectors on the Zumo 32U4 Front Sensor Array.
Definition at line 24 of file Zumo32U4IRPulses.h.
This enum defines the two different sets of LEDs that can be used to emit pulses.
Enumerator | |
---|---|
Left | The LEDs on the left side of the robot. |
Right | The LEDs on the right side of the robot. |
Definition at line 30 of file Zumo32U4IRPulses.h.
|
static |
Starts emitting IR pulses.
direction | Specifies which set of LEDs to turn on. |
brightness | A number that specifies how long each pulse is. The pulse length will be (1 + brightness) / (16 MHz). If brightness is greater than or equal to period , then the LEDs will just be on constantly. |
period | A number that specifies the frequency of the pulses. The interval between consecutive the rising edges of pulses will be (1 + period) / (16 MHz). The default value is 420, which results in a period very close to 38 kHz. |
Definition at line 7 of file Zumo32U4IRPulses.cpp.
|
static |
Stops emitting IR pulses.
Timer 3 can be used for other purposes after calling this function.
Definition at line 74 of file Zumo32U4IRPulses.cpp.
|
static |
The default frequency is 16000000 / (420 + 1) = 38.005 kHz
Definition at line 40 of file Zumo32U4IRPulses.h.