Light Controlled Servo Using LinkitONE

Published

Introduction: 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

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!

Share

    Recommendations

    • Planter Challenge

      Planter Challenge
    • Clocks Contest

      Clocks Contest
    • Casting Contest

      Casting Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    2 Comments

    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.