Assignment: Hallouino

Arduino controlled Silly String shooter

Use the 9V battery to make a standalone (not connected to the computer) Halloween prop. It can be part of your costume or a modification of a commercially available decoration. It should be spoooky!
Shoot a video of the object in action, post it on youtube and link it on the blog.

– It must have at least one input: buttons, potentiometer, sensors

– It must have some kind of output: LEDs and/or servo.

– It shoul work without a computer attached. Program the Arduino, unplug the usb an plug the 9V cable. You can press the tiny reset button to restart the program.

– You can use alligator clips or wire extensions to separate Arduino + board from sensors and actuators.

– You can check the examples in the manual, like the DC motor…

– LEDs themselves are not that exciting, but you can use all sorts of object to diffuse their light ping-pong balls, balloons, pumpkins…

Code Example:
Light sensor controlled twitchy servo. Servo twitches randomly when it gets dark.

#include <Servo.h> 
Servo servo1;
int pos1 = 0;
int period = 500;
int sensorValue = 0;
unsigned long lastDidItTime = 0;

void setup() { 
  servo1.attach(3);  // attaches the servo on pin 3 to the servo object 
  Serial.begin(9600);
} 

void loop() {
  sensorValue = analogRead(A0);
  unsigned long presentTime = millis();
  if(sensorValue < 90){  // if it's dark...
    unsigned long elapsedAmount = presentTime - lastDidItTime;
    if (elapsedAmount > period){  // do something spooky
      pos1 = random (0, 180); 
      servo1.write(pos1);
      lastDidItTime = presentTime;
    }
  }

}
Posted in

Post a comment