Bonjour/bonsoir,
Je suis en train de créer un robot, et il possède un ruban led adressable sur le coté, mais voila, j'ai un problème. J'utilise la bibliothèque FastLEDpour le gérer, et quand je veux allumer mes phares, ils ne font que de clignoter très vite, j'ai remarqué qu'en enlevant la partie
case 'f': FastLED.clear(leds[30,36,8,13]);
le problème n'était plus la ! Mais je ne peux plus les éteindres (pour la communication j'utilise un HC-05)
Voici le code en complet :
#include<FastLED.h>
#define LED_PIN 7
#define NUM_LEDS 44
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available()>0)
{
char data= Serial.read(); // reading the data received from the bluetooth module
switch(data)
{
case 'F': leds[30] = CRGB ( 255, 255, 255); //Phares on
leds[36] = CRGB ( 255, 255, 255);
leds[8] = CRGB ( 255, 0, 0);
leds[13] = CRGB ( 255, 0, 0);
FastLED.show();
case 'f': FastLED.clear(leds[30,36,8,13]);
default : break;
}
Serial.println(data);
}
delay(50);
}