mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[examples] AddressableLED: Add unit test (#4779)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
#include <frc/AddressableLED.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void Rainbow();
|
||||
void RobotInit() override;
|
||||
void RobotPeriodic() override;
|
||||
|
||||
private:
|
||||
static constexpr int kLength = 60;
|
||||
|
||||
// PWM port 9
|
||||
// Must be a PWM header, not MXP or DIO
|
||||
frc::AddressableLED m_led{9};
|
||||
std::array<frc::AddressableLED::LEDData, kLength>
|
||||
m_ledBuffer; // Reuse the buffer
|
||||
// Store what the last hue of the first pixel is
|
||||
int firstPixelHue = 0;
|
||||
};
|
||||
Reference in New Issue
Block a user