On the occasion of the Christmas festivities, we will explore how to create a candy-shaped decoration using LEDs, with the help of the Arduino platform. This project, both aesthetic and creative, will make an ideal light-up decoration to enhance your interior.
Here is the model of the candy we aim to create:
To light up the LEDs of your candy decoration, it will be necessary to program your Arduino board. For this purpose, you can use the Arduino IDE development environment and the following code:
void setup()
{
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
pinMode(0, OUTPUT);
}
void loop()
{
digitalWrite(1, HIGH);
digitalWrite(2, HIGH);
digitalWrite(4, HIGH);
digitalWrite(0, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(1, LOW);
digitalWrite(2, LOW);
digitalWrite(4, LOW);
digitalWrite(0, LOW);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(0, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(2, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(1, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(0, LOW);
digitalWrite(2, LOW);
digitalWrite(1, LOW);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(4, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(1, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(0, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(2, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(2, HIGH);
digitalWrite(1, HIGH);
digitalWrite(0, HIGH);
digitalWrite(4, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(0, LOW);
digitalWrite(1, LOW);
digitalWrite(2, LOW);
digitalWrite(4, LOW);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(1, HIGH);
digitalWrite(2, HIGH);
digitalWrite(4, HIGH);
digitalWrite(0, HIGH);
}