#include <Wire.h>

const int ledPin = 13; // Pin of the built-in LED

void setup() {
  Wire.begin(); // Start I2C as master
  pinMode(ledPin, OUTPUT); // Set pin 13 as output
  Serial.begin(9600);
}

void loop() {
  // Send commands to slave devices with a 3-second delay between each
  digitalWrite(ledPin, HIGH); // Turn on the LED on the Arduino UNO

  delay(3000); // Wait 3 seconds before sending the next command

  sendCommand(0x09, "LED"); // Turn on the LED on Xiao RP2040
  delay(3000); // Wait 3 seconds

  sendCommand(0x0A, "NEO"); // Turn on the Neopixels on Xiao ESP32
  delay(3000); // Wait 3 seconds
}

void sendCommand(byte address, const char* command) {
  Wire.beginTransmission(address);
  Wire.write(command);
  Wire.endTransmission();
}