Hallowuino

I decided to make a mutant Baby Pumpkin Monster in celebration of Hallowuino. If you leave ze monster alone, it is a peaceful jack-o-latern. But, if you push his button, he will seek revenge. His eyes will switch from a yellow glow to flashing red, and his arms will swing with the intent to attack you.

mackenzie_1

If I were to put this piece in gallery, there would be a spooky night background behind it, and a metal link chain would be wrapped around it making it look as if it is being restrained. There would also be a sign next to it that reads: “Beware of Monster: DO NOT PUSH HIS BUTTON”. For some reason it is a natural instinct for people to rebel and press the button in this case, thus making the piece interactive.

Here is the video of my monster:

[flickr video=8148308678 secret=4d30222477 w=400 h=225]

 

Here is the Arduino Fritzing diagram of my monster:

Here is the code for my monster:

#include   // servo library
Servo servo1;  // servo control object
Servo servo2;  // servo control object

int redLED = 12;
int yelLED = 13;
const int buttonPin = 2;

//-----SCARY SETTINGS-----
int redEyeFlashTime = 75;
int motorCalls = 4;

void setup()
{
  pinMode(redLED,OUTPUT);
  pinMode(yelLED,OUTPUT);

  pinMode(buttonPin, INPUT);

  servo1.attach(9);
  servo2.attach(6);

  normalMode ();
}

void loop()
{
  //-----Check Button State-----
  int  buttonState = digitalRead(buttonPin);

  if (buttonState == LOW)
  {
    scaryMode();
  }
  else
  {
    normalMode();
  }
}

void normalMode ()
{
  digitalWrite(redLED, LOW);
  digitalWrite(yelLED, HIGH);
}

void scaryMode ()
{
  //-------SERVO CODE-------
  for(int i = 0; i < motorCalls; i++)
  {
    //int position1 = constrain(random(0, 180), 0, 180);
    int position1 = constrain(random(0, 180), 110, 180);
    servo1.write(position1);  // Move to next position

    int position2 = constrain(random(0, 180), 110, 180);
    servo2.write(position2);  // Move to next position

     //-------LED CODE----------
    digitalWrite(yelLED, LOW);
    digitalWrite(redLED, HIGH);

    delay(redEyeFlashTime);

    digitalWrite(redLED, LOW);

    //-------SERVO CODE-------
    position1 = constrain(random(0, 180), 0, 70);
    servo1.write(position1);  // Move to next position

    position2 = constrain(random(0, 180), 0, 70);
    servo2.write(position2);  // Move to next position

    delay(redEyeFlashTime);
  }
}

Post a comment