Kieran Grayshon

KiloGram coming soon...

Christmas Tree

This project was written in 2018 as I wanted to have a go at making a physical device with the arduino. The idea was to have a wooden tree with 25 LED's that flash different colours in a pattern. The code has been iterated on since then however it is lost due to computer corruption


To view more of the code on Github click here
        
            
#include <FastLED.h>
#define num_leds 25
#define led_pin 2

CRGB led[num_leds];

void setup() {
  FastLED.addLeds<NEOPIXEL, led_pin>(led, num_leds);
  for(int i=0; i<num_leds; i++){
    led[i]=CRGB(0, 0, 255);
  }
  FastLED.show();
}

void red(){
   for(int i=0; i<num_leds; i++){
    led[i]=CRGB(255, 0, 0);
  }
  FastLED.show();
  delay(1000);
}

void green(){
   for(int i=0; i<num_leds; i++){
    led[i]=CRGB(0, 255, 0);
  }
  FastLED.show();
  delay(1000);
}

void blue(){
   for(int i=0; i<num_leds; i++){
    led[i]=CRGB(0, 0, 255);
  }
  FastLED.show();
  delay(1000);
}

void loop() {
  red();
  green();
  blue();
}