005 Controlling A Servo Guide

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 1

Download005-controlling A Servo-guide
Open PDF In BrowserView PDF
Arduino-projekt 005 – Controlling a servo
motor
May 31, 2018 | Example code, Guides | 0 comments
Controlling the position of a servo is very similar to controlling the intensity of a LED.The circuit is
therefore very similar to the one used in project 004. Just like in that project the total resistance of
the potentiometer is not important as long as it is somewhere between 1 KΩ and 100 KΩ.

The circuit
For this project you need to build the following circuit.

Description
A servo expects a pulse-width-modulated (PWM) signal just like the one we used to contorl
the LED in project 002 och 004, but the servo has a little higher requirements and to solve this there
are ready-made code available so we don’t have to do this ourselves every time we want to control
a servo. The first thing we do in our code is to include this ready-made code and then create an object
representing the servo. An object in programming context is basically a variable that has different
functions connected to it for doing various operations on the data that the variable contains. In this
example we use the function attach()to tell the object which output the servot is connected to
and write() to set the position of the servo. The position is given as an angle between 0 and 180
degrees. This means that we need to scale the value read from the pot

Copyright © 2016-2019 Bygga Robot / Invize AB, Org.nr. 559017-7258



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 1
Language                        : sv-SE
Creator                         : Writer
Producer                        : LibreOffice 6.1
Create Date                     : 2019:04:04 23:34:50+02:00
EXIF Metadata provided by EXIF.tools

Navigation menu