Hello, I cannot seem to get anything to happen outside of the main.cpp
file, here is what I have currently.
Main.cpp
:
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>
#include "Power.h"
// #include "Color.h"
#include "OnboardLEDs.h"
#include "LEDs.h"
// Adafruit_NeoPixel strip(8, PIN_PC0, NEO_GRB + NEO_KHZ800);
// static uint16_t startHue = 0;
static OnboardLEDs obleds {};
void setup()
{
// strip.begin();
// strip.show();
// strip.setBrightness(15);
}
void loop()
{
obleds.periodic();
// for (int i = 0; i < 8; i++)
// {
// int pixelHue = (startHue + (i * 360 / 8)) % 360;
// strip.setPixelColor(i, Color::fromHSV(pixelHue, 1, 1));
// }
// strip.show();
// startHue ++;
// startHue %= 360;
}
OnboardLEDs.h
:
#ifndef ONBOARD_LEDS_H
#define ONBOARD_LEDS_H
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>
#include "Color.h"
class OnboardLEDs {
public:
static Adafruit_NeoPixel leds;
static uint16_t startHue;
OnboardLEDs() {
leds = Adafruit_NeoPixel(8, PIN_PC0, NEO_GBR + NEO_KHZ800);
leds.begin();
leds.show();
leds.setBrightness(15);
startHue = 0;
}
void periodic() {
for (int i = 0; i < 8; i++)
{
int pixelHue = (startHue + (i * 360 / 8)) % 360;
leds.setPixelColor(i, Color::fromHSV(pixelHue, 1, 1));
}
leds.show();
startHue++;
startHue %= 360;
};
// void identify();
};
#endif // ONBOARD_LEDS_H
Everthing commented out in the Main.cpp
file works fine on its own, I do not understand why when moving it into its own class it does not work. (Yes I know I should have the implementation in a cpp file I just have been trying to see if I was doing something dumb, so its in the header rn.)