Light Controlled Servo Using LinkitONE

Hello,

Here i'll show you how you can control your servo motor using light!

More light, more the speed of servo motor

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Parts

You will need-

1 x LDR

1 x LinkitONE

1 x Mini Servo

Step 2: Attach Servo Motor

Now we will build the servo motor. After that we will attach it.

We will using PIN 9 to attach the servo.

Step 3: Connect Light Sensor

Connect your LDR. Connect it into A0 pin and ground pin one.

Step 4: Connect USB

Now connect your USB cable with laptop and board so we can power the board.

Step 5: Write Code

Burn this code to your board.

#include'servo.h'

Servo myservo;

int val;

void setup() { myservo.attach(9);

}

void loop() {

val = analogRead(A0);

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

myservo.write(val);

delay(15);

}

Step 6: Test the Servo

Now test your servo!

more light, more speed!

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    2 Discussions

    None
    chuqingsheng

    2 years ago

    My SG90 doesn't work correctly with LinkIt ONE. Why?

    Nice...

    What volt is your servo. My tower pro SG90 servo not run correctly in mediatek board.