loading

While carving a pleasant little pumpkin for the children to find glee and adulation, I accidentally swallowed a pumpkin seed. Laced with Nature's poison, I succumbed to it's decay as neurons tangled, my skin tensed, my blood boiled, I changed. I awoke much later to find this wretched thing before me, unaware of how I built it or why. I am cursed...or...

A rushed build for All Hallows Eve which left improvements like a more generous smoke tray, refined blower, water pump, ambient sound and FLAMES, aborted.

// Dr. Jack Mr. O'Lantern
// TVMiller

#include 
Servo jack;
Servo pour;

const int red = 4;
const int blue = 5;
const int fan = 2;

const int sensor = A0;
// Trigger Distance in CM
const int dist = 90;

void setup() {   
  jack.attach(7);
  jack.write(0);
  pour.attach(3);
  pour.write(10);

  pinMode(red, OUTPUT);
  pinMode(blue, OUTPUT);
  pinMode(fan, OUTPUT);

  Serial.begin(9600);

  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  delay(2500);
  digitalWrite(red, LOW);
  digitalWrite(blue, HIGH);
  delay(2500); 
} 

void loop() {

  jack.write(0);
  pour.write(10);
  digitalWrite(red, HIGH);
  digitalWrite(blue, LOW);
  digitalWrite(fan, LOW);
  delay(20);
  digitalWrite(red, LOW);
  delay(40);
  digitalWrite(red, HIGH);

  long prox, proxcm;
  pinMode(sensor, OUTPUT);
  digitalWrite(sensor, HIGH);
  delayMicroseconds(6);
  digitalWrite(sensor, LOW);
  pinMode(sensor, INPUT);
  prox = pulseIn(sensor, HIGH);
  proxcm = mtc(prox);
  Serial.println(proxcm);

  if (proxcm < dist) {
    digitalWrite(red, LOW);
    pour.write(75);
    jack.write(130);
    delay(100);
    digitalWrite(fan, HIGH);
    delay(2000);
    digitalWrite(blue, HIGH);
    delay(10000);
  }

  delay(100);
}

long mtc(long ms) {  
  return ms / 29 / 2; 
}

About This Instructable

11views

1favorite

License:

Bio: Privateer
More by TVMiller:Arduino Splash Resistant Toilet Foamer Arduino Motion Mute 1992 Isuzu Trooper Windshield Wiper Single Button Hack 
Add instructable to: