Introduction: Arduino Mini Spotlight

Picture of Arduino Mini Spotlight

This is a mini led spotlight that I made which can be controlled by a potentiometer.

Step 1: Materials

Picture of Materials

You will need:

Arduino Uno Rev 3

Radioshack Standard Servo

Potentiometer(I used a 10k)

6v Battery Pack

Breadboard

Jumper wires

Small led Flashlight

Step 2: Attach the Potentiometer

Picture of Attach the Potentiometer

The first step is pretty simple just attach the potentiometer as shown in the picture.

Step 3: Attaching the Servo

Picture of Attaching the Servo

Attach the servo as shown in this picture.

Step 4: Attaching the Battery Pack

Picture of Attaching the Battery Pack

Attach the battery pack as shown in this picture.

Step 5: The Led Light

Picture of The Led Light

For this next step you can attach the led by wrapping it around the servo horn.

Step 6: CODE!!!

The code for this project is pretty simple just copy and paste this program right here and upload it into the arduino:

#include <Servo.h>

int potPin = 2;

int pos;

Servo myservo;

void setup()

{

myservo.attach(9);

}

void loop()

{

pos = analogRead(potPin);

pos = map(pos, 0, 1023, 0, 179);

myservo.write(pos);

}

Step 7: Your Done

Picture of Your Done

If you made it to this step then that means your done with the project. To use this project just turn on the power, turn on the led and twist the potentiometer to move the led.

Comments

ibenkos (author)2014-10-18

Smart idea! Thanks for shearig :)

seamster (author)2014-09-26

Nicely done. Thanks for sharing this!

About This Instructable

1,437views

9favorites

License:

Bio: I'm a teenage male that has an interest in arduino, robots and other awesome stuff.
More by ArduinoStuffs:Arduino light showArduino Mini Spotlight
Add instructable to: