WS2812B | ||
Avant le Setup | Importation de la bibliothèque | #include |
Création de l’objet | #define NUM_LEDS * (* indique le nombre de Led à allumer), #define DATA-PIN 3 (borne de la carte sur laquelle est branchée le ruban de Led, CRGBleds [NUM_LEDS]; | |
Dans le Setup | Démarrage de l’objet | FastLED.addLeds |
Dans le Loop | Utilisation | FastLED.show() ; |
#include
// How many leds in your strip?
#define NUM_LEDS 1
// For led chips like WS2812, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
// Clock pin only needed for SPI based chipsets when not using hardware SPI
#define DATA_PIN D3
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
// Uncomment/edit one of the following lines for your leds arrangement.
// ## Clockless types ##
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
// FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical
}
void loop() {
// Turn the LED on, then pause
leds[0] = CRGB::Red;
FastLED.show();
delay(500);
// Now turn the LED off, then pause
leds[0] = CRGB::Black;
FastLED.show();
delay(500);
}
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #