Help Configuration Arduino MEGA + 32 RELAIS sur Xlights

Youpcoco

New member
Bonjour,
Utilisateur d'une carte Arduino M?ga avec le logiciel Vixens depuis 1 an afin d'alimenter en On/OFF des guirlandes de Noel, je pr?vois de passer sur Xlight cette ann?e.
Or je n'arrive pas ? impl?menter ma configuration pass?e (et donc fonctionnelle sur Vixens) sur Xlight.
Pourriez vous m'aider svp ?
Voici le code televerser sur la carte Arduino

Good morning,
User of an Arduino Mega card with Vixens software for 1 year in order to power Christmas garlands on/off, I plan to switch to Xlight this year.
But I can't do it? implement my past configuration (and therefore functional on Vixens) on Xlight.
Could you help me please ?
Here is the code uploaded to the Arduino board

Code:
#define MEGA_VIXEN
//#define UNO_VIXEN

#ifdef MEGA_VIXEN
#define MAX_CHANNELS 32
int channels[MAX_CHANNELS] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33};
#endif

#ifdef UNO_VIXEN
#define MAX_CHANNELS 8
int channels[MAX_CHANNELS] = {2, 3, 4, 5, 6, 7, 8, 9};
#endif

#define POWER_UP_STATE HIGH //0 = Lights off at power up, 255 = lights on at power up
#define INACTIVITY_STATE LOW //0 = Lights off when inactive, 255 = lights on when inactive

#define INACTIVITY_TIMEOUT_MILLISECONDS (5UL * 1000UL) // 5 = 5 seconds, 1000 = 1000 milliseconds in a second

int incomingByte[MAX_CHANNELS];

unsigned long inactivityTimer;

void setup()
{
  int i;

  Serial.begin(9600); // set up Serial at 9600 bps

  for ( i = 0; i < MAX_CHANNELS; i ++ )
  {
    pinMode(channels[i], OUTPUT);
    digitalWrite(channels[i], POWER_UP_STATE);
  }

  inactivityTimer = millis();
}

void loop()
{
  int i;

  if (Serial.available() >= MAX_CHANNELS)
  {
    for (i = 0; i < MAX_CHANNELS; i ++) incomingByte[i] = Serial.read();
    inactivityTimer = millis();
  }

  if ( (millis() - inactivityTimer) >= INACTIVITY_TIMEOUT_MILLISECONDS )
  {
    for ( i = 0; i < MAX_CHANNELS; i ++ ) incomingByte[i] = INACTIVITY_STATE;
  }

  for (i = 0; i < MAX_CHANNELS; i ++ ) digitalWrite(channels[i], ~incomingByte[i]);
}
La configuration dans Vixens qui fonctionne est aussi fourni.

Merci de votre aide
 

Attachments

  • Capture d'?cran 2023-09-22 165004.png
    Capture d'?cran 2023-09-22 165004.png
    51.6 KB · Views: 5
Last edited:
USB controller
Generic serial
Save
Go back into it (click somewhere else then click on the controller)
set com port and speed
Ready to go

However, the code is poorly written. It should using a prefix or change to using Renard protocol.

I do like your inactivity timer though. That is cool way to leave the lights in a certain way.
 
Hello to you.
Thank you for your answers. Unfortunately I think I have already fulfilled your requests. Here is the configuration entered concerning the controller and also the configuration of the element to be turned on/off. Xlight communicates with the arduino but only reacts on the same relay and not the right one.
Concerning the code, it is not mine, I admit that I do not understand this part of the work.Capture d'?cran 2023-09-22 165004.pngCapture d'?cran 2023-09-22 165042.jpgCapture d'?cran 2023-09-23 082332.pngCapture d'?cran 2023-09-23 082343.png
 
How many channels are the candy canes?
Are they all set to color red?

This line might be causing a problem if you have less than 32 channels configured in models.
#define MAX_CHANNELS 32

Change it to the number of channels you have elements for. If you have 8 candy canes, change it to 8.
 
Last edited:
Back
Top