Bonjour a tous
voila mon petit problème j'ai un ruban de 30 leds branché sur un esp32 le ruban lui est alimenter avec un chargeur usb de 2A ,les moins sont connectés ensemble
le tout gérer par node red installer sur un raspberry
quand j'allume les leds pas de probleme, elles s'allument tres bien si je les etteinds dans les quelques secondes suivantes tout va bien (je me sert du code rgb(0,0,0) pour les étteindres).
mais apres un moment (non déterminé mais au moins plusieurs minutes ) seulement les premières leds (environ une dizaine) se coupe mais pas les autres, le changement de couleur est identique les premières changent de couleur mais pas le reste
alors que tout au début il y a environ deux mois tout fonctionnait correctement
je me demande si je ne devrais pas rajouter un condensateur ou autre
voila mon code
#include "FastLED.h"
#define NUM_LEDS 30 //nombre de led sur le ruban
#define DATA_PIN 5 // numero du pin de raccordement du ruban
#define EVERY_NTH
CRGB leds[NUM_LEDS];
String c = "" ;
String monString3 ;
String monString2 ;
char *token;
int r = 0;
int g = 0;
int b = 0;
int i = 0;
const char s[2] = ",";
#include <WiFi.h>
const char* ssid = "********";
const char* password = "*********";
WiFiServer server(80);
void setup()
{
LEDS.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
Serial.begin(9600);
pinMode(5, OUTPUT);
delay(10);
Serial.println();
Serial.println();
Serial.print("connexion ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected.");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
server.begin();
}
int value = 0;
void loop() {
WiFiClient client = server.available(); // listen for incoming clients
if (client) { // if you get a client,
Serial.println("New Client."); // print a message out the serial port
String currentLine = ""; // make a String to hold incoming data from the client
while (client.connected()) { // loop while the client's connected
if (client.available()) { // if there's bytes to read from the client,
String c = client.readStringUntil('\r');
//-----------------------------------------------------------------
currentLine += c;
monString2 = c.substring(0, 1); // lecture du premier caractere(r)
monString3 = c.substring(4);// lecture a partir du 4eme caractere
char str[monString3.length() + 1];
monString3.toCharArray(str, monString3.length() + 1);
/* CALCUL DE R */
token = strtok(str, s);
r = atof(token);
/* BOUCLE une seuke fois*/
while ( token != NULL ) {
/* CALCUL DE G */
token = strtok(NULL, ",");
g = atof(token);
/* CALCUL DE B */
token = strtok(NULL, ",");
b = atof(token);
delay(1000);
break;
/* SORTIE DE BOUCLE */
}
for (int i = 0; i < NUM_LEDS; i++) {
leds[i].r = r; leds[i].g = g; leds[i].b = b;
}
LEDS.show();
}
}
}
client.stop();
}