Project not doing what it should (DMX and I2C communication)

Heyo, kinda weird thing
I'm currently working on a project that has a Master Arduino (uno) that get's a dmx signal and interprets it in values for PWM pins of the Slave arduino (nano) which should give out the PWM values and turn LEDs on and off pretty much.
The communication normaly is good, i've let it run quite a few times with just turning the leds off and on in a sinus wave, i've also tried just that with the dmx shiel already so that i know that it doesn't block the i2c communication.
But as soon as i don't let it run a manual sinus wave and try it the dmx Way it doesn't do anything.... the master arduino receives the right signals, i've seen that, but apparently it doesn't work...
my ideas would be
1: It doesn't turn the dmx values into the pwm values or
2: sth in the code with dmx is blocking the i2c communication
but i'm more thinking the 2nd point bc i've let the serial monitor run on the slave arduino and apparently it didn't receive anything from the master...

can anybody help?
Master arduino code (Arduino Uno)

#include <Wire.h>
#include <Conceptinetics.h>
#include <TM1637Display.h>
#include <EEPROM.h>

// Pins for the buttons
const int buttonMinusPin = A0; // Change to analog pin
const int buttonPlusPin = A1; // Change to analog pin

// Pins for the TM1637 Display
const int CLK = 2; // Pin for CLK
const int DIO = 3; // Pin for DIO

// Variables for the buttons
int lastButtonMinusState = HIGH;
int lastButtonPlusState = HIGH;
unsigned long lastDebounceTimeMinus = 0;
unsigned long lastDebounceTimePlus = 0;
unsigned long debounceDelay = 50;

unsigned long buttonPressStartTimeMinus = 0;
unsigned long buttonPressStartTimePlus = 0;
bool isButtonPressedMinus = false;
bool isButtonPressedPlus = false;

// DMX Slave object
#define DMX_SLAVE_CHANNELS 3 // Number of DMX channels
#define RXEN_PIN 2 // RXEN Pin (Receive enable)

DMX_Slave dmx_slave(DMX_SLAVE_CHANNELS, RXEN_PIN); // Create DMX_Slave object

// TM1637 Display object
TM1637Display display(CLK, DIO);

// EEPROM memory address for DMX address
const int eepromAddress = 0;

void setup() {
  Wire.begin(); // Start I2C

  pinMode(buttonMinusPin, INPUT_PULLUP);
  pinMode(buttonPlusPin, INPUT_PULLUP);

  pinMode(10, OUTPUT);  // Define pin 10 as output
  digitalWrite(10, HIGH); // Output 5V continuously

  // Initialize DMX Slave
  dmx_slave.enable(); // Enable DMX Slave

  // Read DMX start address from EEPROM
  int storedAddress = EEPROM.read(eepromAddress);
  if (storedAddress < 1 || storedAddress > 512 - DMX_SLAVE_CHANNELS + 1) {
    storedAddress = 1; // Default address if invalid address in EEPROM
  }
  dmx_slave.setStartAddress(storedAddress); // Set DMX start address

  // Initialize TM1637 Display
  display.setBrightness(0x0f); // Maximum brightness

  // Show initial DMX address on display
  display.showNumberDec(dmx_slave.getStartAddress(), true);
}

void loop() {
  handleButtonPresses();

  // Example: Map DMX values to PWM values and send
  int dmxAddress = 1; // Example channel 1
  int dmxValue = dmx_slave.getChannelValue(dmxAddress);
  int pwmValue = map(dmxValue, 0, 255, 0, 1023);
  sendPWMValues(pwmValue, pwmValue, pwmValue); // Example: send same PWM values to both devices

  // Example: Display DMX address on the display
  display.showNumberDec(dmx_slave.getStartAddress(), true);

  // Wait a bit to control the update speed
  delay(2); // Reduce delay to update display 5x faster
}

void handleButtonPresses() {
  int buttonMinusState = analogRead(buttonMinusPin) < 512 ? LOW : HIGH;
  int buttonPlusState = analogRead(buttonPlusPin) < 512 ? LOW : HIGH;
  unsigned long currentTime = millis();

  // Minus button
  if (buttonMinusState == LOW && lastButtonMinusState == HIGH) {
    lastDebounceTimeMinus = currentTime;
    buttonPressStartTimeMinus = currentTime;
    isButtonPressedMinus = true;
  } else if (buttonMinusState == HIGH && lastButtonMinusState == LOW) {
    if (isButtonPressedMinus && currentTime - buttonPressStartTimeMinus >= debounceDelay) {
      int currentAddress = dmx_slave.getStartAddress();
      dmx_slave.setStartAddress(max(1, currentAddress - 1));
      EEPROM.write(eepromAddress, dmx_slave.getStartAddress()); // Save DMX start address in EEPROM
      isButtonPressedMinus = false;
    }
  } else if (buttonMinusState == LOW && isButtonPressedMinus && currentTime - buttonPressStartTimeMinus >= 1000) {
    unsigned long interval = map(currentTime - buttonPressStartTimeMinus, 1000, 2000, 20, 2);
    interval = max(interval, 2); // Minimum interval of 2ms
    if (currentTime - buttonPressStartTimeMinus >= interval) {
      int currentAddress = dmx_slave.getStartAddress();
      dmx_slave.setStartAddress(max(1, currentAddress - 1));
      EEPROM.write(eepromAddress, dmx_slave.getStartAddress()); // Save DMX start address in EEPROM
      buttonPressStartTimeMinus = currentTime;
    }
  }
  lastButtonMinusState = buttonMinusState;

  // Plus button
  if (buttonPlusState == LOW && lastButtonPlusState == HIGH) {
    lastDebounceTimePlus = currentTime;
    buttonPressStartTimePlus = currentTime;
    isButtonPressedPlus = true;
  } else if (buttonPlusState == HIGH && lastButtonPlusState == LOW) {
    if (isButtonPressedPlus && currentTime - buttonPressStartTimePlus >= debounceDelay) {
      int currentAddress = dmx_slave.getStartAddress();
      dmx_slave.setStartAddress(min(512 - DMX_SLAVE_CHANNELS + 1, currentAddress + 1));
      EEPROM.write(eepromAddress, dmx_slave.getStartAddress()); // Save DMX start address in EEPROM
      isButtonPressedPlus = false;
    }
  } else if (buttonPlusState == LOW && isButtonPressedPlus && currentTime - buttonPressStartTimePlus >= 1000) {
    unsigned long interval = map(currentTime - buttonPressStartTimePlus, 1000, 2000, 20, 2);
    interval = max(interval, 2); // Minimum interval of 2ms
    if (currentTime - buttonPressStartTimePlus >= interval) {
      int currentAddress = dmx_slave.getStartAddress();
      dmx_slave.setStartAddress(min(512 - DMX_SLAVE_CHANNELS + 1, currentAddress + 1));
      EEPROM.write(eepromAddress, dmx_slave.getStartAddress()); // Save DMX start address in EEPROM
      buttonPressStartTimePlus = currentTime;
    }
  }
  lastButtonPlusState = buttonPlusState;
}

void sendPWMValues(int pwmValue1, int pwmValue2, int pwmValue3) {
  Wire.beginTransmission(0x01);
  Wire.write(pwmValue1 >> 8); // Send high byte of PWM value for pin 1
  Wire.write(pwmValue1 & 0xFF); // Send low byte of PWM value for pin 1
  Wire.write(pwmValue2 >> 8); // Send high byte of PWM value for pin 2
  Wire.write(pwmValue2 & 0xFF); // Send low byte of PWM value for pin 2
  Wire.write(pwmValue3 >> 8); // Send high byte of PWM value for pin 3
  Wire.write(pwmValue3 & 0xFF); // Send low byte of PWM value for pin 3
  Wire.endTransmission();
}

Slave code:

#include <Wire.h>

// Definition of PWM pins
const int pwmPin1 = 3;
const int pwmPin2 = 5;
const int pwmPin3 = 6;

// Timeout constants
const unsigned long timeoutInterval = 500; // 500 ms timeout interval
unsigned long lastReceiveTime = 0; // Time of last received data

void setup() {
  // Set PWM pins as output
  pinMode(pwmPin1, OUTPUT);
  pinMode(pwmPin2, OUTPUT);
  pinMode(pwmPin3, OUTPUT);

  Wire.begin(0x01); // Start I2C with address 0x01
  Wire.onReceive(receiveEvent); // Register the receive event handler

  // Turn off LEDs initially
  analogWrite(pwmPin1, 0);
  analogWrite(pwmPin2, 0);
  analogWrite(pwmPin3, 0);
}

void loop() {
  // Check if timeout has been exceeded
  if (millis() - lastReceiveTime > timeoutInterval) {
    // Turn off the LEDs
    analogWrite(pwmPin1, 0);
    analogWrite(pwmPin2, 0);
    analogWrite(pwmPin3, 0);
  }
}

void receiveEvent(int howMany) {
  if (howMany == 3) {
    int pwmValue1 = Wire.read(); // Receive PWM value for pin 1
    int pwmValue2 = Wire.read(); // Receive PWM value for pin 2
    int pwmValue3 = Wire.read(); // Receive PWM value for pin 3
    // Set PWM values for the pins
    analogWrite(pwmPin1, pwmValue1);
    analogWrite(pwmPin2, pwmValue2);
    analogWrite(pwmPin3, pwmValue3);

    // Update the time of last received data
    lastReceiveTime = millis();
  }
}

sorry for the long code wall... hope somebody can help

Why would you use two Arduinos? The UNO should be able to do it more efficiently then the current implementation. The communication is adding a lot of overhead. For PWM you simply set and forget it. Different value just set it again, a simple analog write command.

i kinda have to do it that way cause the Uno is gonna be kind of a hub who get's the dmx signal and sends it to 1 to 3 different lamps that have a nano controling the the LEDs.

How far apart are they?

like 10cm max
more like 5

Try it with one UNO, should not be a problem. If it were meters I would suggest you look at CAN as the messages would be short. You could update all three with a single transmission. Nice part all the arbitration, priority, error correction, detection etc is done for you.

yeah, but the system i'm building won't work with that.
it's a "must have" that i have one hub that interprets the dmx values and sends it to each lamp.

I think you have incorrectly defined the master.
Check out the examples in the library.

i mean master in sense of "hub" getting the dmx signal and sending it to the lamp
for what i know defining it as master it would send out the dmx value (like a lighting controler) instead of receiving it
right?

Not a problem, you have 2048 different devices if you use the ID 11 bits. The 29 bits will give you a lot more. This keeps the wiring simple especially when changing gigs. A simple message has a ID (11 bits), how many bytes follow (0-8) and up to 8 bytes in the message. These can all be intermixed without any problems on the same pair of wires. The ID separates the messages. Wiring would be point to point termination on last one. This will also be a lot less overhead on your UNO. FYI any node can be a master if so desired.

All nodes will receive all messages, your software determines what to ignore. There are built in hardware filters that will do this for you but not needed at this point.

A rough example would be the audio snake, all the stuff goes in and out the ends but all goes through the cable in the middle. You determine what goes where by changing plugs, in CAN the software will do that for you.

this is not what dmx was conceived for. it exist no hub. only one master and 255 slaves. your Uno-"Hub" board is able to do all the work on its own, without additional Nanos.

this is wrong

why is it wrong and how can i fix it?

what is dmxValue ? how big value is possible?

it's the normal value you get from a dmx channel
a value between 0 and 255

well, you need it for function analogWrite(), how big value it accept?

a DMX signal is always between 0 and 255, so ig that's the max value?

i asked about analogWrite()

for how i understand it that's also 255

you are right
now i think you used some AI-generator. ChatGPT ?