I have moved a project to Teensy 4 from 3.2. I had to use the FastLED library as the WS2812Serial library doesn't work on the Teensy 4.* I can use my Neopixel array with FastLED on Teensy 4 but when I add a trivial interrupt the display is corrupted. Any suggestions?
#include <FastLED.h>
#define DATA_PIN 8
int brightness = 20;
// Teensy 4.0 Stuff ================
#define NUM_LEDS_PER_STRIP 16
#define NUM_STRIPS 1
#define NUM_LEDS * NUM_LEDS_PER_STRIP
CRGB leds[NUM_LEDS_PER_STRIP * NUM_STRIPS];
IntervalTimer sampleTimer;
void setup() {
delay(1000);
// Teensy 4.0 Stuff ==============
FastLED.addLeds<NUM_STRIPS, WS2812B,DATA_PIN,GRB>(leds, NUM_LEDS_PER_STRIP);
//USE for WS2811: * * *
FastLED.setBrightness(brightness);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 1500);
set_max_power_indicator_LED(13);
fill_solid(leds, NUM_LEDS, CRGB::Black);
FastLED.show();
splash_screen();
sampleTimer.begin(adc_process_sample,250);
}
void loop() {
df_pointer(CRGB::White, CRGB::Red, 2);
delay(2000);
}
void splash_screen(){
df_pointer(CRGB::White, CRGB::White, 0);
delay(1);
df_pointer(CRGB::White, CRGB::White, 0);
delay(2000);
df_pointer(CRGB::Red, CRGB::Red, 0);
delay(2000);
df_pointer(CRGB::Green, CRGB::Green, 0);
delay(2000);
df_pointer(CRGB::Blue, CRGB::Blue, 0);
delay(2000);
}
void df_pointer(CRGB color_pointer, CRGB color_background, uint16_t point_to){
for (uint16_t i = 0; i <NUM_LEDS; i++) {
leds = color_background;
if(i == point_to) leds = color_pointer;
}
FastLED.show();
}
void adc_process_sample(void){
return;
}
#include <FastLED.h>
#define DATA_PIN 8
int brightness = 20;
// Teensy 4.0 Stuff ================
#define NUM_LEDS_PER_STRIP 16
#define NUM_STRIPS 1
#define NUM_LEDS * NUM_LEDS_PER_STRIP
CRGB leds[NUM_LEDS_PER_STRIP * NUM_STRIPS];
IntervalTimer sampleTimer;
void setup() {
delay(1000);
// Teensy 4.0 Stuff ==============
FastLED.addLeds<NUM_STRIPS, WS2812B,DATA_PIN,GRB>(leds, NUM_LEDS_PER_STRIP);
//USE for WS2811: * * *
FastLED.setBrightness(brightness);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 1500);
set_max_power_indicator_LED(13);
fill_solid(leds, NUM_LEDS, CRGB::Black);
FastLED.show();
splash_screen();
sampleTimer.begin(adc_process_sample,250);
}
void loop() {
df_pointer(CRGB::White, CRGB::Red, 2);
delay(2000);
}
void splash_screen(){
df_pointer(CRGB::White, CRGB::White, 0);
delay(1);
df_pointer(CRGB::White, CRGB::White, 0);
delay(2000);
df_pointer(CRGB::Red, CRGB::Red, 0);
delay(2000);
df_pointer(CRGB::Green, CRGB::Green, 0);
delay(2000);
df_pointer(CRGB::Blue, CRGB::Blue, 0);
delay(2000);
}
void df_pointer(CRGB color_pointer, CRGB color_background, uint16_t point_to){
for (uint16_t i = 0; i <NUM_LEDS; i++) {
leds = color_background;
if(i == point_to) leds = color_pointer;
}
FastLED.show();
}
void adc_process_sample(void){
return;
}