mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
29 lines
731 B
C
29 lines
731 B
C
|
|
// 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;
|
||
|
|
};
|