This circuit consists of two Arduino Nano microcontrollers, a 5V battery, and three WS2812 RGB LED strips. The primary Arduino Nano controls the LED strips by sending data signals to each strip's data input pin. The secondary Arduino Nano generates trigger signals that are sent to the primary Arduino Nano to initiate LED blinking sequences. The 5V battery provides power to the entire circuit, ensuring that the microcontrollers and LED strips are adequately powered.
#define LED_PIN1 2 // Data pin for the first LED strip
#define LED_PIN2 3 // Data pin for the second LED strip
#define LED_PIN3 4 // Data pin for the third LED strip
#define TRIGGER_PIN1 10 // Trigger pin for the first strip
#define TRIGGER_PIN2 9 // Trigger pin for the second strip
#define TRIGGER_PIN3 8 // Trigger pin for the third strip
#define NUM_LEDS 10 // Number of LEDs per strip
// Function prototypes
void sendOne(uint8_t pin);
void sendZero(uint8_t pin);
void sendColor(uint8_t pin, uint8_t r, uint8_t g, uint8_t b);
void showStrip(uint8_t pin);
void blinkStrip(uint8_t pin);
void setup() {
// Initialize LED and trigger pins
pinMode(LED_PIN1, OUTPUT);
pinMode(LED_PIN2, OUTPUT);
pinMode(LED_PIN3, OUTPUT);
pinMode(TRIGGER_PIN1, INPUT);
pinMode(TRIGGER_PIN2, INPUT);
pinMode(TRIGGER_PIN3, INPUT);
// Ensure LEDs are off initially
digitalWrite(LED_PIN1, LOW);
digitalWrite(LED_PIN2, LOW);
digitalWrite(LED_PIN3, LOW);
}
void loop() {
// Check for trigger signals and blink the corresponding LED strip
if (digitalRead(TRIGGER_PIN1) == HIGH) {
blinkStrip(LED_PIN1);
}
if (digitalRead(TRIGGER_PIN2) == HIGH) {
blinkStrip(LED_PIN2);
}
if (digitalRead(TRIGGER_PIN3) == HIGH) {
blinkStrip(LED_PIN3);
}
}
// Implementation of functions to control the LED strips
// ...
#define TRIGGER_PIN1 2 // Pin D2
#define TRIGGER_PIN2 3 // Pin D3
#define TRIGGER_PIN3 4 // Pin D4
void setup() {
// Initialize trigger pins as outputs
pinMode(TRIGGER_PIN1, OUTPUT);
pinMode(TRIGGER_PIN2, OUTPUT);
pinMode(TRIGGER_PIN3, OUTPUT);
}
void loop() {
// Generate trigger signals in sequence
digitalWrite(TRIGGER_PIN1, HIGH);
delay(1000);
digitalWrite(TRIGGER_PIN1, LOW);
delay(1000);
digitalWrite(TRIGGER_PIN2, HIGH);
delay(1000);
digitalWrite(TRIGGER_PIN2, LOW);
delay(1000);
digitalWrite(TRIGGER_PIN3, HIGH);
delay(1000);
digitalWrite(TRIGGER_PIN3, LOW);
delay(1000);
}
This documentation provides an overview of the circuit's components, their wiring, and the embedded code that controls the LED strips. The primary Arduino Nano is responsible for driving the LEDs, while the secondary Arduino Nano generates the trigger signals. The 5V battery supplies power to the entire system.