Devices & Components
Arduino Nano
Resistor 221 ohm
Solderless Breadboard Half Size
USB-A to Mini-USB Cable
Jumper wires (generic)
Custom PCB
RGB Diffused Common Anode
Hardware & Tools
Solder Wire, Lead Free
Solder Flux, Soldering
3D Printer (generic)
Soldering iron (generic)
Software & Tools
Arduino IDE
Project description
Code
Code
arduino
Wanted to change color each LED individually simultaneously.
1#define RED_PIN 11 // where the red pin is connected to 2#define GREEN_PIN 10 // where the green pin is connected to 3#define BLUE_PIN 9 // where the blue pin is connected to 4#define RED2_PIN 8 // where the red pin is connected to 5#define GREEN2_PIN 7 // where the green pin is connected to 6#define BLUE2_PIN 6 // where the blue pin is connected to 7#define RED3_PIN 5 // where the red pin is connected to 8#define GREEN3_PIN 4 // where the green pin is connected to 9#define BLUE3_PIN 3 // where the blue pin is connected to 10#define DELAY 10 // 10ms internal delay; increase for slower fades 11 12void setup() { 13 pinMode(GREEN_PIN, OUTPUT); 14 pinMode(BLUE_PIN, OUTPUT); 15 pinMode(RED_PIN, OUTPUT); 16 pinMode(GREEN2_PIN, OUTPUT); 17 pinMode(BLUE2_PIN, OUTPUT); 18 pinMode(RED2_PIN, OUTPUT); 19 pinMode(GREEN3_PIN, OUTPUT); 20 pinMode(BLUE3_PIN, OUTPUT); 21 pinMode(RED3_PIN, OUTPUT); 22} 23 24void loop() { 25 // fade from green to red 26 for(int i=0; i<255; i++) { 27 analogWrite(RED_PIN, i);analogWrite(RED2_PIN, 0);analogWrite(RED3_PIN, 255-i); 28 analogWrite(GREEN_PIN, 255-i);analogWrite(GREEN2_PIN, i);analogWrite(GREEN3_PIN, 0); 29 analogWrite(BLUE_PIN, 0);analogWrite(BLUE2_PIN, 255-i);analogWrite(BLUE3_PIN, i); 30 delay(DELAY); 31 } 32 33 // fade from red to blue 34 for(int i=0; i<255; i++) { 35 analogWrite(RED_PIN, 255-i);analogWrite(RED2_PIN, i);analogWrite(RED3_PIN, 0); 36 analogWrite(GREEN_PIN, 0);analogWrite(GREEN2_PIN, 255-i);analogWrite(GREEN3_PIN, i); 37 analogWrite(BLUE_PIN, i);analogWrite(BLUE2_PIN, 0);analogWrite(BLUE3_PIN, 255-i); 38 delay(DELAY); 39 } 40 41 // fade from blue to green 42 for(int i=0; i<255; i++) { 43 analogWrite(RED_PIN, 0);analogWrite(RED2_PIN, 255-i);analogWrite(RED3_PIN, i); 44 analogWrite(GREEN_PIN, i);analogWrite(GREEN2_PIN, 0);analogWrite(GREEN3_PIN, 255-i); 45 analogWrite(BLUE_PIN, 255-i);analogWrite(BLUE2_PIN, i);analogWrite(BLUE3_PIN, 0); 46 delay(DELAY); 47 } 48}
Code
arduino
Wanted to change color each LED individually simultaneously.
1#define RED_PIN 11 // where the red pin is connected to 2#define GREEN_PIN 10 // where the green pin is connected to 3#define BLUE_PIN 9 // where the blue pin is connected to 4#define RED2_PIN 8 // where the red pin is connected to 5#define GREEN2_PIN 7 // where the green pin is connected to 6#define BLUE2_PIN 6 // where the blue pin is connected to 7#define RED3_PIN 5 // where the red pin is connected to 8#define GREEN3_PIN 4 // where the green pin is connected to 9#define BLUE3_PIN 3 // where the blue pin is connected to 10#define DELAY 10 // 10ms internal delay; increase for slower fades 11 12void setup() { 13 pinMode(GREEN_PIN, OUTPUT); 14 pinMode(BLUE_PIN, OUTPUT); 15 pinMode(RED_PIN, OUTPUT); 16 pinMode(GREEN2_PIN, OUTPUT); 17 pinMode(BLUE2_PIN, OUTPUT); 18 pinMode(RED2_PIN, OUTPUT); 19 pinMode(GREEN3_PIN, OUTPUT); 20 pinMode(BLUE3_PIN, OUTPUT); 21 pinMode(RED3_PIN, OUTPUT); 22} 23 24void loop() { 25 // fade from green to red 26 for(int i=0; i<255; i++) { 27 analogWrite(RED_PIN, i);analogWrite(RED2_PIN, 0);analogWrite(RED3_PIN, 255-i); 28 analogWrite(GREEN_PIN, 255-i);analogWrite(GREEN2_PIN, i);analogWrite(GREEN3_PIN, 0); 29 analogWrite(BLUE_PIN, 0);analogWrite(BLUE2_PIN, 255-i);analogWrite(BLUE3_PIN, i); 30 delay(DELAY); 31 } 32 33 // fade from red to blue 34 for(int i=0; i<255; i++) { 35 analogWrite(RED_PIN, 255-i);analogWrite(RED2_PIN, i);analogWrite(RED3_PIN, 0); 36 analogWrite(GREEN_PIN, 0);analogWrite(GREEN2_PIN, 255-i);analogWrite(GREEN3_PIN, i); 37 analogWrite(BLUE_PIN, i);analogWrite(BLUE2_PIN, 0);analogWrite(BLUE3_PIN, 255-i); 38 delay(DELAY); 39 } 40 41 // fade from blue to green 42 for(int i=0; i<255; i++) { 43 analogWrite(RED_PIN, 0);analogWrite(RED2_PIN, 255-i);analogWrite(RED3_PIN, i); 44 analogWrite(GREEN_PIN, i);analogWrite(GREEN2_PIN, 0);analogWrite(GREEN3_PIN, 255-i); 45 analogWrite(BLUE_PIN, 255-i);analogWrite(BLUE2_PIN, i);analogWrite(BLUE3_PIN, 0); 46 delay(DELAY); 47 } 48}
Downloadable files
PCB
My custom PCB circuite diagram
PCB

PCB
My custom PCB circuite diagram
PCB

Documentation
The Helix Sculpture
The top helix sculpture creators site
https://www.thingiverse.com/thing:113549
THe Stand
THe base where all the components are stored
https://www.thingiverse.com/thing:4554086
The Helix Sculpture
The top helix sculpture creators site
https://www.thingiverse.com/thing:113549
Comments
Only logged in users can leave comments