326__CHRISTMAS TREE
Quote from Defran on January 6, 2024, 10:50 am326_CHRISTMAS TREE. (Simulide R2094 or higher.)
Christmas tree with colored lights flashing linearly and randomly. Simply load the project and run the program, the entire tree lights up non-stop.
SCHEME:
Based on Arduino (Controller ATmega328), a set of 12 lines connected to as many outputs with 4 colored LEDs each and 2 more connected to the edges of the tree with yellow LEDs. The controller outputs are linked to the LEDs of the tree through “Simulide-tunnels” to avoid a tangle of cables. An oscillator with very low frequency is connected to A5 as a randomness seed.
PROGRAM:
The action of the program is to execute a series of random sequences to illuminate the colored LEDs linearly and the edge LEDs in a random digital connection. No library is used and the most used main instruction is: V4=random(60,255); analogWrite(L4, V4); delay(reta). The random values will range between 60 so that the LED does not turn off completely and 255 for its maximum illumination.
// CHRISMAS TREE. DEFRAN23 int L2=2; int L3=3; int L4=4; int V4=0; int delV4=0; int L5=5; int V5=0; int delV5=0; int L6=6; int V6=0; int delV6=0; int L7=7; int V7=0; int delV7=0; int L8=8; int V8=0; int delV8=0; int L9=9; int V9=0; int delV9=0; int L10=10; int V10=0; int delV10=0; int L11=11; int V11=0; int delV11=0; int L12=12; int V12=0; int delV12=0; int L13=13; int L14=14; int L15=15; int L16=16; int L17=17; int reta=20; // DELAY LEDS int retal=10; // DELAY PENDING LED void setup() { randomSeed(A5); pinMode(L2, OUTPUT); // PENDING pinMode(L3, OUTPUT); // PENDING pinMode(L4, OUTPUT); // RED pinMode(L5, OUTPUT); // GREEN pinMode(L6, OUTPUT); // BLUE pinMode(L7, OUTPUT); // YELLOW pinMode(L8, OUTPUT); // ORANGE pinMode(L9, OUTPUT); // MAGENTA pinMode(L10, OUTPUT); // CYAN pinMode(L11, OUTPUT); // WHITE pinMode(L12, OUTPUT); // ___________ pinMode(L13, OUTPUT); // MONITOR pinMode(L14, OUTPUT); // RED_STAR pinMode(L15, OUTPUT); // GREEN_STAR pinMode(L16, OUTPUT); // BLUE_STAR pinMode(L17, OUTPUT); // FOCO digitalWrite(L13, HIGH); } void loop() { digitalWrite(L2, HIGH); delay(retal); // 2_PENDING V4=random(60,255); analogWrite(L4, V4); delay(reta); // A_RED digitalWrite(L2, LOW); delay(retal); // 2_PENDING digitalWrite(L3, HIGH); delay(retal); // 3_PENDING V5=random(60,255); analogWrite(L5, V5); delay(reta); // B_GREEN V6=random(60,255); analogWrite(L6, V6); delay(reta); // C_BLUE digitalWrite(L3, LOW); delay(retal); // 3_PENDING digitalWrite(L17, HIGH); delay(retal); // FOCO V7=random(60,255); analogWrite(L7, V7); delay(reta); // D_YELLOW V8=random(60,255); analogWrite(L8, V8); delay(reta); // E_ORANGE V9=random(60,255); analogWrite(L9, V9); delay(reta); // F_MAGENTA V10=random(60,255); analogWrite(L10, V10); delay(reta); // G_CYAN V11=random(60,255); analogWrite(L11, V11); delay(reta); // H_WHITW digitalWrite(L17, LOW); delay(retal); // 7_FOCO }
SUBCIRCUITS:
This example integrates several subcircuits located in the "data" folder into the ZIP attached. This folder must always be next to the "sim1" scheme so that it can be executed. A SUBCIRCUIT is a “custom” circuit that accumulates a set of Simulide base components (primitive function) to obtain a new or an adapted function. These subcircuits are treated by Simulide as another component of its own structure. User can create his own subcircuits once the procedure is known, explained in detail in the simulide tutorials: Subcircuit tutorial in Simulide.
* Communication with the author: Simulide/User/Messages/Defran
P. de Francisco.
326_CHRISTMAS TREE. (Simulide R2094 or higher.)
Christmas tree with colored lights flashing linearly and randomly. Simply load the project and run the program, the entire tree lights up non-stop.
SCHEME:
Based on Arduino (Controller ATmega328), a set of 12 lines connected to as many outputs with 4 colored LEDs each and 2 more connected to the edges of the tree with yellow LEDs. The controller outputs are linked to the LEDs of the tree through “Simulide-tunnels” to avoid a tangle of cables. An oscillator with very low frequency is connected to A5 as a randomness seed.
PROGRAM:
The action of the program is to execute a series of random sequences to illuminate the colored LEDs linearly and the edge LEDs in a random digital connection. No library is used and the most used main instruction is: V4=random(60,255); analogWrite(L4, V4); delay(reta). The random values will range between 60 so that the LED does not turn off completely and 255 for its maximum illumination.
// CHRISMAS TREE. DEFRAN23
int L2=2;
int L3=3;
int L4=4; int V4=0; int delV4=0;
int L5=5; int V5=0; int delV5=0;
int L6=6; int V6=0; int delV6=0;
int L7=7; int V7=0; int delV7=0;
int L8=8; int V8=0; int delV8=0;
int L9=9; int V9=0; int delV9=0;
int L10=10; int V10=0; int delV10=0;
int L11=11; int V11=0; int delV11=0;
int L12=12; int V12=0; int delV12=0;
int L13=13;
int L14=14;
int L15=15;
int L16=16;
int L17=17;
int reta=20; // DELAY LEDS
int retal=10; // DELAY PENDING LED
void setup()
{
randomSeed(A5);
pinMode(L2, OUTPUT); // PENDING
pinMode(L3, OUTPUT); // PENDING
pinMode(L4, OUTPUT); // RED
pinMode(L5, OUTPUT); // GREEN
pinMode(L6, OUTPUT); // BLUE
pinMode(L7, OUTPUT); // YELLOW
pinMode(L8, OUTPUT); // ORANGE
pinMode(L9, OUTPUT); // MAGENTA
pinMode(L10, OUTPUT); // CYAN
pinMode(L11, OUTPUT); // WHITE
pinMode(L12, OUTPUT); // ___________
pinMode(L13, OUTPUT); // MONITOR
pinMode(L14, OUTPUT); // RED_STAR
pinMode(L15, OUTPUT); // GREEN_STAR
pinMode(L16, OUTPUT); // BLUE_STAR
pinMode(L17, OUTPUT); // FOCO
digitalWrite(L13, HIGH);
}
void loop()
{
digitalWrite(L2, HIGH); delay(retal); // 2_PENDING
V4=random(60,255); analogWrite(L4, V4); delay(reta); // A_RED
digitalWrite(L2, LOW); delay(retal); // 2_PENDING
digitalWrite(L3, HIGH); delay(retal); // 3_PENDING
V5=random(60,255); analogWrite(L5, V5); delay(reta); // B_GREEN
V6=random(60,255); analogWrite(L6, V6); delay(reta); // C_BLUE
digitalWrite(L3, LOW); delay(retal); // 3_PENDING
digitalWrite(L17, HIGH); delay(retal); // FOCO
V7=random(60,255); analogWrite(L7, V7); delay(reta); // D_YELLOW
V8=random(60,255); analogWrite(L8, V8); delay(reta); // E_ORANGE
V9=random(60,255); analogWrite(L9, V9); delay(reta); // F_MAGENTA
V10=random(60,255); analogWrite(L10, V10); delay(reta); // G_CYAN
V11=random(60,255); analogWrite(L11, V11); delay(reta); // H_WHITW
digitalWrite(L17, LOW); delay(retal); // 7_FOCO
}
SUBCIRCUITS:
This example integrates several subcircuits located in the "data" folder into the ZIP attached. This folder must always be next to the "sim1" scheme so that it can be executed. A SUBCIRCUIT is a “custom” circuit that accumulates a set of Simulide base components (primitive function) to obtain a new or an adapted function. These subcircuits are treated by Simulide as another component of its own structure. User can create his own subcircuits once the procedure is known, explained in detail in the simulide tutorials: Subcircuit tutorial in Simulide.
* Communication with the author: Simulide/User/Messages/Defran
P. de Francisco.
Uploaded files: