Hi there, I am new to the Teensy world (while somewhat experienced with Arduinos and ESP32s) and doing my very first steps on the Teensy 4.1.
I tried to play a little with three SK6805 RGB LEDs, the FastLED lib and the Teensy. THe following sketch ran on an Arduino Nano (except different pin names and no debug output) as I expected, but on the Teensy I only see the LEDs in stable bright white:
What am I missing here?
I tried to play a little with three SK6805 RGB LEDs, the FastLED lib and the Teensy. THe following sketch ran on an Arduino Nano (except different pin names and no debug output) as I expected, but on the Teensy I only see the LEDs in stable bright white:
Code:
#include <Arduino.h>
#include <FastLED.h>
#define DATA_PIN 1
#define NUM_LEDS 3
CRGB leds[NUM_LEDS];
bool LEDSTATE(false);
void setup() {
Serial.begin(115200);
Serial.println("--OK--");
FastLED.addLeds<SK6812, DATA_PIN, RGB>(leds, NUM_LEDS);
FastLED.setBrightness(25);
leds[1] = CRGB::Black;
leds[2] = CRGB::Black;
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
}
void loop() {
static uint32_t tic = millis();
if (millis() - tic >= 1000) {
digitalWrite(LED_BUILTIN, LEDSTATE ? HIGH : LOW);
LEDSTATE = !LEDSTATE;
// Turn the LED on with a random color
uint8_t red = random8();
uint8_t green = random8();
uint8_t blue = random8();
Serial.printf("R=%3d G=%3d B=%3d\n", red, green, blue);
leds[0].setRGB(red, green, blue);
// Now shift the LED
leds[2] = leds[1];
leds[1] = leds[0];
// Update!
FastLED.show();
tic = millis();
}
}
What am I missing here?