Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Nano RGB LED Controller with Battery Power

View and Edit Project In Cirkit DesignerImage of Arduino Nano RGB LED Controller with Battery Power

Circuit Documentation

Summary

This circuit consists of an Arduino Nano microcontroller, a 5V battery, and an RGB LED. The Arduino Nano is used to control the RGB LED, which is powered by the 5V battery. The RGB LED can display different colors based on the signals received from the Arduino Nano.

Component List

5V Battery

RGB LED (Wokwi compatible)

Arduino Nano

Wiring Details

5V Battery

RGB LED (Wokwi compatible)

Arduino Nano

Code Documentation

Arduino Nano Code

void setup() {
  int Rled = 2;
  int Gled = 3;
  int Bled = 4;
  pinMode(Rled, OUTPUT);
  pinMode(Gled, OUTPUT);
  pinMode(Bled, OUTPUT);
}

void loop() {
  int Rled = 2;
  int Gled = 3;
  int Bled = 4;
  digitalWrite(Gled, HIGH);
  digitalWrite(Rled, LOW);
  digitalWrite(Bled, HIGH);
  digitalWrite(Gled, LOW);
  digitalWrite(Rled, HIGH);
  digitalWrite(Bled, LOW);
}

This code initializes the RGB LED pins (D2, D3, and D4) as outputs in the setup() function. In the loop() function, it alternates the states of the RGB LED pins to create different colors.