LasseBakHansen
New member
Hi,
I've currently moved to a Teensy 4.0 from Aruduino in the hope that the higher clock speed would remove my interupt issues when running FastLED with TeensyDMX; however this hasnt quite worked out.
Therefore, finding Paul's WS2812Serial library using DMA to write out WS2812 whilst avoid issues reading incoming DMX data sounds perfect and removes the issues I'm having.
My Setup:
- WS2815 Led strip
- Teensy 4.0
- 5v to 3.3v LLC
- FastLED library installed
- WS2812 Library installed
- Arduino IDE 1.8.12 installed
- Teensyduino version 1.52 installed
My Issue:
"Basic Test" Sketch Example = nothing happens:
I'm using pin 8, 72 LEDs and GRB Led strip - should work right?
FastLED Cylon Example Sketch = get a error code:
The "Cylon" example from FastLED runs successfully, however if i use the "FastLED Cylon" example sketch from WS2812Serial library, that doesnt work, it just returns the below error:
no matching function for call to 'CFastLED::addLeds(CRGB [72], int)'
This issue occurs when I adapt the sketch for parallel output, which seems to be the only way to get FastLED to work on Teensy 4.0 - code below:
I'm pretty ready to give up and buy some 4 wire APA102 Led strips to solve this problem, but would have to buy a lot of new kit (i.e. 5v power transformers or 12v to 5v DC-DC converters) so would love if someone could help out an amateur please! Would really appreciate it.
I've currently moved to a Teensy 4.0 from Aruduino in the hope that the higher clock speed would remove my interupt issues when running FastLED with TeensyDMX; however this hasnt quite worked out.
Therefore, finding Paul's WS2812Serial library using DMA to write out WS2812 whilst avoid issues reading incoming DMX data sounds perfect and removes the issues I'm having.
My Setup:
- WS2815 Led strip
- Teensy 4.0
- 5v to 3.3v LLC
- FastLED library installed
- WS2812 Library installed
- Arduino IDE 1.8.12 installed
- Teensyduino version 1.52 installed
My Issue:
"Basic Test" Sketch Example = nothing happens:
I'm using pin 8, 72 LEDs and GRB Led strip - should work right?
Code:
#include <WS2812Serial.h>
const int numled = 72;
const int pin = 8;
// Usable pins:
// Teensy LC: 1, 4, 5, 24
// Teensy 3.2: 1, 5, 8, 10, 31 (overclock to 120 MHz for pin 8)
// Teensy 3.5: 1, 5, 8, 10, 26, 32, 33, 48
// Teensy 3.6: 1, 5, 8, 10, 26, 32, 33
// Teensy 4.0: 1, 8, 14, 17, 20, 24, 29, 39
byte drawingMemory[numled*3]; // 3 bytes per LED
DMAMEM byte displayMemory[numled*12]; // 12 bytes per LED
WS2812Serial leds(numled, displayMemory, drawingMemory, pin, WS2812_GRB);
#define RED 0xFF0000
#define GREEN 0x00FF00
#define BLUE 0x0000FF
#define YELLOW 0xFFFF00
#define PINK 0xFF1088
#define ORANGE 0xE05800
#define WHITE 0xFFFFFF
// Less intense...
/*
#define RED 0x160000
#define GREEN 0x001600
#define BLUE 0x000016
#define YELLOW 0x101400
#define PINK 0x120009
#define ORANGE 0x100400
#define WHITE 0x101010
*/
void setup() {
leds.begin();
}
void loop() {
// change all the LEDs in 1.5 seconds
int microsec = 1500000 / leds.numPixels();
colorWipe(RED, microsec);
colorWipe(GREEN, microsec);
colorWipe(BLUE, microsec);
colorWipe(YELLOW, microsec);
colorWipe(PINK, microsec);
colorWipe(ORANGE, microsec);
colorWipe(WHITE, microsec);
}
void colorWipe(int color, int wait) {
for (int i=0; i < leds.numPixels(); i++) {
leds.setPixel(i, color);
leds.show();
delayMicroseconds(wait);
}
}
FastLED Cylon Example Sketch = get a error code:
The "Cylon" example from FastLED runs successfully, however if i use the "FastLED Cylon" example sketch from WS2812Serial library, that doesnt work, it just returns the below error:
no matching function for call to 'CFastLED::addLeds(CRGB [72], int)'
This issue occurs when I adapt the sketch for parallel output, which seems to be the only way to get FastLED to work on Teensy 4.0 - code below:
Code:
#include <FastLED.h>
#define DATA_PIN 8
#define NUM_LEDS_PER_STRIP 72
#define NUM_STRIPS 1
#define NUM_LEDS NUM_LEDS_PER_STRIP
CRGB leds[NUM_LEDS_PER_STRIP * NUM_STRIPS];
void setup() {
Serial.begin(57600);
Serial.println("resetting");
FastLED.addLeds<NUM_STRIPS, WS2812SERIAL,DATA_PIN,GRB>(leds, NUM_LEDS_PER_STRIP);
LEDS.setBrightness(84);
}
void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } }
void loop() {
static uint8_t hue = 0;
Serial.print("x");
// First slide the led in one direction
for(int i = 0; i < NUM_LEDS; i++) {
// Set the i'th led to red
leds[i] = CHSV(hue++, 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
fadeall();
// Wait a little bit before we loop around and do it again
delay(10);
}
Serial.print("x");
// Now go in the other direction.
for(int i = (NUM_LEDS)-1; i >= 0; i--) {
// Set the i'th led to red
leds[i] = CHSV(hue++, 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
fadeall();
// Wait a little bit before we loop around and do it again
delay(10);
}
}
I'm pretty ready to give up and buy some 4 wire APA102 Led strips to solve this problem, but would have to buy a lot of new kit (i.e. 5v power transformers or 12v to 5v DC-DC converters) so would love if someone could help out an amateur please! Would really appreciate it.