Introduction: Arduino Halloween Night Light

HI, my name is Joshua.When I was looking on line, I found a interesting topic which is also a Arduino night light.

The link is https://www.instructables.com/id/Arduino-Night-Li...

I took his Idea and add some more tools to make the Night light more Halloween. Let's talks about my project!

My project can be use in Halloween , I'll put the candy box on the bottom when someone want to talk the candy.It will trigger arduino ,skeleton beside the candy box will start to shine and turn back and forward until the candy box back to where it was.

Here is what U need for making the Halloween night light

Supplies

A Box

1 Arduino board

3 220 Ohm resistors

1 10k resistor

3 LEDs

1 Servo Motor

8 wire extensions

miscellaneous wires for connections

1 light resistor

Step 1: Set Up

make sure u have put the light and resistor in to correct place

Step 2: Writing

IF u want to try it at home, here is my code

You can click the link below.

https://create.arduino.cc/editor/Joshua_m2/33971f8...

#include
Servo myservo;

int pos = 90;

const int led = 3;

void setup() //改

{

pinMode( 2 , INPUT);

pinMode( 13 , OUTPUT);

pinMode( 12 , OUTPUT);

Serial.begin(9600);

pinMode(led, OUTPUT);

myservo.attach(9); //改

}

void loop() //改

{

int sensor_value = analogRead(A0);

if (sensor_value < 800)

{

digitalWrite( 13 , LOW );

digitalWrite( 12 , HIGH );

digitalWrite(led, HIGH);

pos = 120;

myservo.write(pos);

delay(600);

Serial.println(sensor_value);

}

else {

digitalWrite( 13 , HIGH );

digitalWrite( 12 , LOW );

digitalWrite(led, LOW);

pos = 85;

myservo.write(pos);

delay(600);

Serial.println(sensor_value);

}

}

Step 3: Build Your Arduino Board

This is the easiest step here, you can decide what you want your night light looks like.

As long as the light resistor,Servo Motor and the button is available to see and touch

Step 4: Here Is the Video