Cruise and Tes’ Halloween

It starts from

But it’s hard and tired to act like this for hours, so we start to think about something else.And it remingd me that people in Halloween pretend to be some other creatures, and I have somebody not human but are living in human life style.

So Halloween would be the day that it’s normal for them to dress up and go outside showing off. So we decide to prepare something for them! We prepare their outfitting in different style and a lantern to make them more obvious(Also, I think it’s some kinds of tradtional to connect moon, lantern with bunny. And that ould be fun to add some more Halloween elements)

So I used Laser cutter to etch the pumpkin, clover and bunny on Arycrlic sheets. Then, cutting the neopixel strip into small piece and connceted(soldering) them to make it flexible and easy to hide inside the lantern.

here is the arduino code

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

// Which pin on the Arduino is connected to the NeoPixels?
#define PIXEL_PIN 1 // On Trinket or Gemma, suggest changing this to 1

#define BUTTON_PIN 2    // Digital IO pin connected to the button.  This will be
                          // driven with a pull-up resistor so the switch should
                          // pull the pin to ground momentarily.  On a high -> low
                          // transition the button press logic will execute.

#define BRIGHTNESS  66

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 14 // Popular NeoPixel ring size

// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter -- see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels(NUMPIXELS, PIXEL_PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 200 // Time (in milliseconds) to pause between pixels

// digital pin 2 has a pushbutton attached to it. Give it a name:
int ledPin = 1;
int buttonPin = 2;
int buttonState = 0;         

void setup() {
  // make the pushbutton's pin an input:  
  pinMode(ledPin, OUTPUT);  
  pinMode(buttonPin, INPUT_PULLUP);

   // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  // Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  // END of Trinket-specific code.

  pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
}


void loop() {
  // put your main code here, to run repeatedly:
  buttonState = digitalRead(buttonPin);

  // if button pushed, pixel clear, 
  // one acrylic lights up randomly. a.k.a.suiji
  
// test();
  if (buttonState == LOW) {
    pixels.clear(); 
    digitalWrite(ledPin, HIGH);
    suiji();
//    test();
  }

  //if not pushed, it keeps looping. a.k.a.xiajibaliang
  else {
//    digitalWrite(ledPin, LOW);
    xiajibaliang();
  }

  
}

void test(){
    pixels.clear(); // Set all pixel colors to 'off'
      pixels.setPixelColor(0, pixels.Color(0, 0, 0));
      pixels.setPixelColor(1, pixels.Color(0, 0, 0));
      pixels.setPixelColor(2, pixels.Color(0, 0, 0));
      pixels.setPixelColor(3, pixels.Color(0, 0, 0));
  pixels.show();
  
  }
void  suiji(){
  //light up one acrylic randomly
  // The first NeoPixel in a strand is #0, second is 1, all the way up
  // to the count of pixels minus one.
  int i=random(1, 5);
  if (i=1){
      pixels.setPixelColor(0, pixels.Color(0, 0, 0));
      pixels.setPixelColor(1, pixels.Color(0, 0, 0));
      pixels.setPixelColor(2, pixels.Color(0, 0, 0));
      pixels.setPixelColor(3, pixels.Color(0, 0, 0));
      }else{
   if (i=2){
      pixels.setPixelColor(4, pixels.Color(0, 0, 0));
      pixels.setPixelColor(5, pixels.Color(0, 0, 0));
      pixels.setPixelColor(6, pixels.Color(0, 0, 0));
      pixels.setPixelColor(7, pixels.Color(0, 0, 0));
      }else{
   if (i=3){
      pixels.setPixelColor(8, pixels.Color(0, 0, 0));
      pixels.setPixelColor(9, pixels.Color(0, 0, 0));
      pixels.setPixelColor(10, pixels.Color(0, 0, 0));
      }else{
   if (i=4){
      pixels.setPixelColor(11, pixels.Color(0, 0, 0));
      pixels.setPixelColor(12, pixels.Color(0, 0, 0));
      pixels.setPixelColor(13, pixels.Color(0, 0, 0));
      }
      }
      }
      }
        pixels.show();

      delay(5000);
  }

void  xiajibaliang(){

  // The first NeoPixel in a strand is #0, second is 1, all the way up
  // to the count of pixels minus one.
  for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
    pixels.clear(); // Set all pixel colors to 'off'

    // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
    // Here we're using a moderately bright green color:
    pixels.setPixelColor(i, pixels.Color(random(0,255), 0, random(0,255)));

    pixels.show();   // Send the updated pixel colors to the hardware.

    delay(DELAYVAL); // Pause before next pass through loop
  } 
  
  }

It’s hard to connect small piece chips and parts, especially when we have to solder small pieces with short wires.Next time I would try to avoid making things in this scale.

Leave a Reply