Intro: Servo Motor With LinkitONE
Hello friends do you know about basic electronics. Have you ever heard about link it one...With it we can create those short of electronic things which we can only think about...Working with link it one makes it really easy to fulfil our dreams and bring it into action in front of the entire world.....Today I am going to present a small view of the project which can be done using a link it one as compare to those great project which can be done using it....
To rotate the servo motor on pressing the switch.
Note :- Servo motor is a type of geared motor that can only rotate 180 degrees. It is controlled by sending electrical pulses from your board. These pulses tell the motor what position it should move to.
Switch or pushbutton is momentary switches that close a circuit when pressed. They snap into breadboard easily. These are good for detecting on / off signals.
Step 1: Tools Required
- Servo motor
Step 2: Programming
#include //it is a header file for servo motor
pinMode(5,OUTPUT); //it defines the digital pin 5 as output
servol.attach(9); //it defines the digital pin 9 as output
switchstate=digitalRead(5); //digitalRead checks the chosen pin 5 for voltage
if(switchstate==LOW) //it is a conditional statement
servol.write(1); //it commands the servo motor to set its position to 1 degree
servol.write(179); //it commands the servo motor to set its position to 179 degree
delay(2000); //it calls a delay for 2 seconds
Step 3: Connecting - Switch
Take a link it one and connect it with your laptop.
Take a breadboard and place a switch on it.
Connect the digital pin 5 with one end of the switch and ground it with the same side.
Step 4: Connecting - Servo
Connect it from the 5 volt pin with the other side.
Connect one end of the servo motor with the 5 volt.
Connect its other end with the ground.
Connect the digital pin 9 to the middle pin of the servo motor.
Step 5: Try It
Now try it out....
This project may develop a feeling of interest for LinkitONE inside you. Through this program you will be able to understand the basic use of LinkitONE clearly and will make you capable of handling it.
You will be able to understand the basic use of LinkitONE with the descriptions given above.