Created
March 4, 2026 00:10
-
-
Save flexgrip/f5209fba121b0c6f1c920d6dbef58dcd to your computer and use it in GitHub Desktop.
Trying to get simhub sketch to work with an SK9822
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef __SHRGBLEDSNEOPIXELFASTLED_H__ | |
| #define __SHRGBLEDSNEOPIXELFASTLED_H__ | |
| #define FASTLED_ALLOW_INTERRUPTS 1 | |
| #include <Arduino.h> | |
| #include "SHRGBLedsBase.h" | |
| #include <FastLED.h> | |
| CRGB SHRGBLedsNeoPixelFastLeds_leds[WS2812B_RGBLEDCOUNT]; | |
| class SHRGBLedsNeoPixelFastLeds : public SHRGBLedsBase { | |
| private: | |
| unsigned long lastRead = 0; | |
| public: | |
| void begin(int maxLeds, int righttoleft, bool testMode) { | |
| SHRGBLedsBase::begin(maxLeds, righttoleft); | |
| FastLED.addLeds<SK9822, 5, 6, BGR, DATA_RATE_MHZ(2)>(SHRGBLedsNeoPixelFastLeds_leds, maxLeds); | |
| if (testMode > 0) { | |
| for (int i = 0; i < maxLeds; i++) { | |
| setPixelColor(i, 255, 0, 0); | |
| } | |
| } | |
| FastLED.show(); | |
| } | |
| void show() { | |
| FastLED.show(); | |
| //delay(10); | |
| } | |
| protected: | |
| void setPixelColor(uint8_t lednumber, uint8_t r, uint8_t g, uint8_t b) { | |
| SHRGBLedsNeoPixelFastLeds_leds[lednumber].setRGB(r, g, b); | |
| } | |
| }; | |
| #endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment