Files
allwpilib/wpilibcExamples/src/main/cpp/examples/AddressableLED/include/Robot.h

29 lines
731 B
C
Raw Normal View History

// 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;
};