Arduino uno + shield dmx + ws2812b

Bonjour

Je réalise en se moment un projet qui comprend des bandes leds adressables ws2812b contrôlées par une arduino uno + un shield dmx CTC-DRA-10-R2.
J'ai essayé plusieurs librairie comme : dmxSimple, dmxSerial et je n'ai jamais réussi a faire un code qui marche. Le but serait que sur le contrôleur dmx quand on active le canal 1 la bande led mette un effet.

Si quelqu'un pouvait m'aider a soit faire un code qui marche soit me partager un code qui pour eux marche. (je suis débutant dans le codage)

Merci

Post mis dans la mauvaise section, on parle anglais dans les forums généraux. ➜ déplacé vers le forum francophone.

Merci de prendre en compte les recommandations listées dans "Les bonnes pratiques du Forum Francophone".

1 Like

Est-ce cette version du shield ?
image

As-tu une bibliothèque pour contrôler le shield ?
Ca a l'air assez rare, j'en vois une ici :

Elle est aussi mentionnée dans ce document :

La bibli contient un exemple, que je reproduis ici :

#include <Conceptinetics.h>

//
// CTC-DRA-13-1 ISOLATED DMX-RDM SHIELD JUMPER INSTRUCTIONS
//
// If you are using the above mentioned shield you should 
// place the RXEN jumper towards G (Ground), This will turn
// the shield into read mode without using up an IO pin
//
// The !EN Jumper should be either placed in the G (GROUND) 
// position to enable the shield circuitry 
//   OR
// if one of the pins is selected the selected pin should be
// set to OUTPUT mode and set to LOGIC LOW in order for the 
// shield to work
//

//
// The slave device will use a block of 10 channels counting from
// its start address.
//
// If the start address is for example 56, then the channels kept
// by the dmx_slave object is channel 56-66
//
#define DMX_SLAVE_CHANNELS   10 

//
// Pin number to change read or write mode on the shield
// Uncomment the following line if you choose to control 
// read and write via a pin
//
// On the CTC-DRA-13-1 shield this will always be pin 2,
// if you are using other shields you should look it up 
// yourself
//
///// #define RXEN_PIN                2


// Configure a DMX slave controller
DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );

// If you are using an IO pin to control the shields RXEN
// the use the following line instead
///// DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS , RXEN_PIN );

const int ledPin = 13;

// the setup routine runs once when you press reset:
void setup() {             
  
  // Enable DMX slave interface and start recording
  // DMX data
  dmx_slave.enable ();  
  
  // Set start address to 1, this is also the default setting
  // You can change this address at any time during the program
  dmx_slave.setStartAddress (1);
  
  // Set led pin as output pin
  pinMode ( ledPin, OUTPUT );
}

// the loop routine runs over and over again forever:
void loop() 
{
  //
  // EXAMPLE DESCRIPTION
  //
  // If the first channel comes above 50% the led will switch on
  // and below 50% the led will be turned off
  
  // NOTE:
  // getChannelValue is relative to the configured startaddress
  if ( dmx_slave.getChannelValue (1) > 127 )
    digitalWrite ( ledPin, HIGH );
  else
    digitalWrite ( ledPin, LOW ); 
}

Tu peux déjà commencer par le tester avec la LED de la Uno (pin 13). Le code allume la LED ou l'éteint selon que la valeur reçue sur le channel 1 est supérieure ou inférieure à 127.

Ensuite tu peux tester le contrôle d'une bande de LEDs WS2812, avec une bibliothèque adaptée. Tout est très bien expliqué ici :

Notamment les connexions :

Pour contrôler ces bandes ou anneaux de LEDs, il y a 2 bibliothèques :

Quand tu auras compris le fonctionnement des deux, tu pourras commencer à les utiliser ensemble.

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