Hi!
Als blutiger Anfänger (mit Programmierkenntnissen) habe ich ein Projekt begonnen:
Ansteuerung von knapp 1000 WS2812B-LEDs mit einem DUE mit der FastLED-Library.
Am UNO funktionert mein kleines Testprogramm sehr gut, allerdings ist bei knapp über 500 LEDs der Speicher des UNO voll. Daher einfach den DUE geordert, der ja schneller ist und mehr Speicher hat.
Die 3,3V am Datenpin hochzusetzen auf 5V ist mit einer kleinen Hardwarebastelei ja auch kein Problem.
ABER:
Das am UNO laufende Testprogramm tut am DUE leider nicht. Der DUE scheint beim Befehl FastLED.show() stehen zu bleiben. Ich habe in meinem Testprogramm eine Ausgabe auf Serial hinzugefügt, die beim UNO auch brav läuft, beim DUE aber nicht. Kommentiere ich den Befehl FastLED.show() aus, läuft die Ausgabe auf dem seriellen Monitor auch am DUE problemlos.
Hier mein Testprogramm (In Zeile 81 ist die betreffende Stelle mit dem Befehl FastLED.show():
// Use if you want to force the software SPI subsystem to be used for some reason (generally, you don't)
// #define FORCE_SOFTWARE_SPI
// Use if you want to force non-accelerated pin access (hint: you really don't, it breaks lots of things)
// #define FORCE_SOFTWARE_SPI
// #define FORCE_SOFTWARE_PINS
#include "FastLED.h"
///////////////////////////////////////////////////////////////////////////////////////////
//
// Move a white dot along the strip of leds. This program simply shows how to configure the leds,
// and then how to turn a single pixel white and then off, moving down the line of pixels.
//
// How many leds are in the strip?
#define NUM_LEDS 550
// Data pin that led data will be written out over
#define DATA_PIN 3
// Clock pin only needed for SPI based chipsets when not using hardware SPI
//#define CLOCK_PIN 8
// This is an array of leds. One item for each led in your strip.
CRGB leds[NUM_LEDS];
//*** start *** Test only, to monitor program running
#define LED_ANZ 30
boolean L_13=false;
int wiederh = 0;
int zaehler = 0;
//*** end *** Test only, to monitor program running
// This function sets up the ledsand tells the controller about them
void setup() {
// sanity check delay - allows reprogramming if accidently blowing power w/leds
delay(2000);
// Uncomment one of the following lines for your leds arrangement.
// FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
// FastLED.addLeds<WS2811_400, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<P9813, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// Pin 13 Initialisieren
//*** start *** Test only, to monitor program running
pinMode(13, OUTPUT);
Serial.begin(9600);
//*** end *** Test only, to monitor program running
}
// This function runs over and over, and is where you do the magic to light
// your leds.
void loop() {
// Move a single white led
for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
// Turn our current led on to white, then show the leds
leds[whiteLed] = CRGB::White;
if (whiteLed+LED_ANZ<NUM_LEDS) leds[whiteLed+LED_ANZ] = CRGB::Blue;
if (whiteLed+LED_ANZ*2<NUM_LEDS) leds[whiteLed+LED_ANZ*2] = CRGB::Red;
if (whiteLed+LED_ANZ*3<NUM_LEDS)leds[whiteLed+LED_ANZ*3] = CRGB::Green;
// Show the leds (only one of which is set to white, from above)
FastLED.show();
//*** start *** Test only, to monitor program running
wiederh++;
if (wiederh>100) wiederh=0;
zaehler++;
if (zaehler = 10)
{
Serial.print(wiederh);
Serial.print (" ");
Serial.println(L_13);
if (L_13 == false)
{
//LED 13 leuchten lassen
L_13 = true;
//digitalWrite(13, L_13);
}
else
{
L_13 = false;
//digitalWrite(13, L_13);
}
digitalWrite(13, L_13);
zaehler=0;
}
//*** end *** Test only, to monitor program running
// Wait a little bit
delay(25);
// Turn our current led back to black for the next loop around
if (whiteLed >= LED_ANZ) {
leds[whiteLed-LED_ANZ] = CRGB::Black;
}
else {
leds[NUM_LEDS-LED_ANZ+whiteLed] = CRGB::Black;
}
}
}
Das ARDUINO-Tool (IDE?) hat Version 1.6.5, die Library FastLED-3.0.3 habe ich heute ganz frisch von GitHub - FastLED/FastLED at 3.0.3 runtergeladen.
Kann mir jemand weiterhelfen, bzw. wo ist mein (Denk-) Fehler?
Danke
Wolfgang