Neo matrix ne fonctionne pas mais pas d'erreur

Bonjour a tous , j'ai acheté des matrices led ws2812. Quand je fais un code avec la librarie FastLED_NeoMatrix.h cela fonctionne par contre quand je prend la librairie Neomatrix.h et <Adafruit_NeoPixel.h rien ne se passe. Pas d'erreur dans le code, cela se deversse normalement.

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>

const int PINMATRIX = 3;

Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32,8, PINMATRIX,
  NEO_MATRIX_TOP    + NEO_MATRIX_LEFT+
  NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
  NEO_GRB            + NEO_KHZ800);

  uint16_t colors[] = {
  matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(255, 210, 0),matrix.Color(0, 0, 255), matrix.Color(255, 0, 255), matrix.Color(0, 255, 255), matrix.Color(255, 255, 255),matrix.Color(91, 68, 43),matrix.Color(0, 0, 0)
  };

static unsigned char play[]={0x00,0x00,0x10,0x18,0x1c,0x18,0x10,0x00};
static unsigned char rond[]={0x00,0x7e,0xff,0xff,0xff,0xff,0xff,0x7e};
static unsigned char sun[]={0x24,0x00,0xbd,0x7e,0x7e,0x7e,0x00,0x00};
static unsigned char mask[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
static unsigned char cloud[]={0x00,0x00,0x00,0x06,0x6f,0xef,0xff,0x7e};
static unsigned char coeur[]={0x00,0x66,0xff,0x7e,0x7e,0x3c,0x18,0x00};

void setup(){
//Ouverture d'un port serie
  Serial.begin(115200);
//Initialisation de la matrice de LED
  matrix.begin();
  matrix.setTextWrap(false);
  matrix.setBrightness(1);
  matrix.setTextColor(colors[0]);
}

void loop() {
  matrix.fillScreen(0); //Efface la matrice de LED
  matrix.setTextColor(colors[5]); //Choix de la couleur numero 5 (0, 255, 255)
  matrix.setCursor(0, 0); //Curseur en position 0,0 (1ere ligne, 1ere colonne)
  matrix.print("Hello"); 
 
  //Dessine la forme (8x8 pixels) coeur à la position 24,0 avec la couleur numero 0
  matrix.drawBitmap(24, 0, coeur, 8,8,colors[0]);
  matrix.show(); //on affiche
  delay(1000);
}

Merci de votre aide.

Bonjour,

Il n'y a pas de raison pour que ton programme ne fonctionne pas.
Comment sont alimentées tes leds neopixel?

avecle nodemcu esp8266. Mais pour l'autre code cela fonctionne.
tu crois qu'il faut mettre une alim 5v?

Pour 32 LEDS, on compte 60mA au plus par LED, ca ferait un courant max de près de 2A, un peu beaucoup pour un petit Arduino... Tu en a 8 fois plus !
Il vaut mieux en effet une alim externe (vérifie sur la datasheet de ton produit pour choisir ton alim au mieux), pour les LEDs et l'Arduino
Adafruit recommande ceci : (voir cette page et les suivantes) C'est pour une bande de LEDs, mais ça doit être bon pour une matrice

Après, pourquoi FastLED fonctionne et pas Adafruit ? Peut-être une question de gestion des LEDs. Prend celle qui fonctionne, sauf si tu as vraiment besoin d'Adafruit

du coup 5 volt et combien d'ampere?

Tout dépend du nombre de leds (pour être large 60 mA par led)

jai 5 matrices de ce type WS2812 8x8 64 LED Matrix Arduino examples - Arduino Learning

20a 5volt ca existe ca

Je pensais que ça définissait une matrice 32 * 8

Tu es sur que c'est le bon numéro de pin?
Quelle est ta carte?
Si tu es connecté sur D3 utilise
const int PINMATRIX = D3;

oui je suis sur le pin 3 mais sur mon autre bout de code je n'ai pas besoin de preciser D3 dans le code avec la lib FastLED_NeoMatrix.h

#include <Adafruit_GFX.h>
#include <FastLED_NeoMatrix.h>
#include <FastLED.h>

#define PIN 3
#define BRIGHTNESS 50

#define mw 40
#define mh 8
#define NUMMATRIX (mw*mh)
CRGB leds[NUMMATRIX];
// Define matrix width and height.
//FastLED_NeoMatrix *matrix = new FastLED_NeoMatrix(leds, mw, mh, 
//  NEO_MATRIX_TOP     + NEO_MATRIX_LEFT +
//    NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE);

FastLED_NeoMatrix *matrix = new FastLED_NeoMatrix(leds, mw, mh, 
  NEO_MATRIX_TOP     + NEO_MATRIX_LEFT +
    NEO_MATRIX_COLUMNS + NEO_MATRIX_PROGRESSIVE);
    
// This could also be defined as matrix->color(255,0,0) but those defines
// are meant to work for adafruit_gfx backends that are lacking color()
#define LED_BLACK    0
uint32_t color_red=matrix->Color(255, 0, 0);
uint32_t color_white=matrix->Color(255, 255, 255);
uint32_t color_black=matrix->Color(0, 0, 0);

const byte YtLogoColors[3][3] = {{0, 0, 0}, {255, 0, 0}, {255, 255, 255}};
const byte YtLogo[8][10] = 
{
  {0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
  {1, 1, 1, 1, 2, 1, 1, 1, 1, 1},
  {1, 1, 1, 1, 2, 2, 1, 1, 1, 1},
  {1, 1, 1, 1, 2, 2, 2, 1, 1, 1},
  {1, 1, 1, 1, 2, 2, 2, 1, 1, 1},
  {1, 1, 1, 1, 2, 2, 1, 1, 1, 1},
  {1, 1, 1, 1, 2, 1, 1, 1, 1, 1},
  {0, 1, 1, 1, 1, 1, 1, 1, 1, 0}
};

void scrolling_line(){
      matrix->clear();
      
        for (int i = 3;i<mw;i++){
          
         for (int y = 2;y<mh;y++){
            //matrix->drawLine(y,z,y,i,color_red);
            // matrix->drawLine(2,1,2,5,color_red);
             matrix->drawLine(8,7,0,0,color_red);
            matrix->show();
            delay(50);
          }
        }
      
}


void setup() {
  // put your setup code here, to run once:
// Time for serial port to work?
    delay(1000);
    Serial.begin(115200);
    Serial.print("Init on pin: ");
    Serial.println(PIN);
    Serial.print("Matrix Size: ");
    Serial.print(mw);
    Serial.print(" ");
    Serial.print(mh);
    Serial.print(" ");
    //Serial.println(NUMMATRIX);
    FastLED.addLeds<NEOPIXEL,PIN>(  leds, NUMMATRIX  ).setCorrection(TypicalLEDStrip);
    //Serial.print("Setup serial: ");
    //Serial.println(NUMMATRIX);
    matrix->begin();
    matrix->setTextWrap(false);
    matrix->setBrightness(BRIGHTNESS);
    matrix->print("Hello");
    
  }

void loop() {
  // put your main code here, to run repeatedly:
scrolling_line();
}

ma carte est une nodemcu esp8266nodemcu

C'est sur cette carte que je viens d'essayer.
C'est certain il faut que tu appelles ta pin D3.
Peut être que FastLed utilise une autre numérotation

Avec FastLed tu as trois possibilité de numérotation des pins

#define FASTLED_ESP8266_RAW_PIN_ORDER
#define FASTLED_ESP8266_NODEMCU_PIN_ORDER
#define FASTLED_ESP8266_D1_PIN_ORDER

Voir ici:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.