EveryCircuit
Contact
Reviews
Home
Redstone_guy
modified 7 months ago

Soothing RGB LEDS from Square Wave generators

5
4
347
03:53:19
I FINALLY nailed the settings of the square wave generators! 🤗 Code for ARDUINO Uno to match results (for single RGB LED, not for NeoPixel strips or rings): const int redLED = 9; //connect with 220-ohm resistor to the red anode of an RGB LED. const int greenLED = 10; //connect with 220-ohm resistor to the green anode of an RGB LED. const int blueLED = 11; //connect with 220-ohm resistor to the blue anode of an RGB LED. int r = 125; //start red at full int g = 0; //start green at zero int b = 0; //start blue at zero void setup(){ pinMode(redLED, OUTPUT); pinMode(greenLED, OUTPUT); pinMode(blueLED, OUTPUT); analogWrite(redLED, r); analogWrite(greenLED, g); analogWrite(blueLED, b); delay(4); } void loop(){ for (int g=0; g<125; g++){ analogWrite(greenLED, g); delay(4); } //intensify green for (int r=125; r>0; r--){ analogWrite(redLED, r); delay(4); } //lessen red for (int b=0; b<125; b++){ analogWrite(blueLED, b); delay(4); } //intensify blue for (int g=125; g>0; g--){ analogWrite(greenLED, g); delay(4); } //lessen green for (int r=0; r<125; r++){ analogWrite(redLED,r); delay(4); } //intensify red for (int b=125; b>0; b--){ analogWrite(blueLED, b); delay(4); } //lessen blue }
published 3 years ago
min007
3 years ago
👏
beslan1980
3 years ago
https://everycircuit.com/circuit/4513285169479680
592azy2circuitdude
2 years ago
Swell circuit 👍. I like how you got lots of colors in your LED strip and reused the voltage sources for multiple LEDs. Pretty clever!
Redstone_guy
2 years ago
@592azy2circuitdude Thx! :)

EveryCircuit is an easy to use, highly interactive circuit simulator and schematic capture tool. Real-time circuit simulation, interactivity, and dynamic visualization make it a must have application for professionals and academia. EveryCircuit user community has collaboratively created the largest searchable library of circuit designs. EveryCircuit app runs online in popular browsers and on mobile phones and tablets, enabling you to capture design ideas and learn electronics on the go.

Copyright © 2025 by MuseMaze, Inc.     Terms of use     Privacy policy