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!