0% found this document useful (0 votes)
13 views2 pages

Chapter 09

The Arduino 'servo.write()' function controls the position of a standard servo by setting its angle between 0 to 180 degrees, while for a continuous rotation servo, it determines the direction and speed of rotation. A standard servo's angle values correspond to specific positions, whereas a continuous servo uses values to indicate speed and direction. Additionally, an example Arduino C program demonstrates how to control a servo motor's position using a potentiometer, updating the servo's position every 100 ms based on the potentiometer's reading.

Uploaded by

khatidenickese
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Chapter 09

The Arduino 'servo.write()' function controls the position of a standard servo by setting its angle between 0 to 180 degrees, while for a continuous rotation servo, it determines the direction and speed of rotation. A standard servo's angle values correspond to specific positions, whereas a continuous servo uses values to indicate speed and direction. Additionally, an example Arduino C program demonstrates how to control a servo motor's position using a potentiometer, updating the servo's position every 100 ms based on the potentiometer's reading.

Uploaded by

khatidenickese
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Chapter 09

Question 6

Explain the operation of the Arduino “servo.write()” library function and discuss how it effects a
standard and continuous rotation servo.

Answer
• Used to write an angle value from 0 to 180 degrees, to control the servo shaft position.
• On a standard servo this will set the angle of the shaft in degrees, moving the shaft to the
desired degree position.
Where a value of:
 0 is fully counter clockwise,  90
is in the middle position, and  180
is fully clockwise.

On a continuous rotation servo, this will set the direction and speed of the servo shaft. Where
a value of:
 0 is full speed counter clockwise rotation, 
90 results in no rotation, and
 180 is full speed clockwise rotation.

Question 10

Write an Arduino C program to control a servo motor with a potentiometer. The servo motor signal
control wire is connected to pin 10 and its control range is from 700 us to 2300 us The 10k pot is connect
to the Arduino A3 pin Update the servo motor position with the pot setting every 100 ms.
Answer
#include <Servo.h>

Servo servoM1;
const int pinPot = A3;

const int servoPin = 10; int

iVal;

void setup() {

servoM1.attach(servoPin);

void loop()

iVal = analogRead(pinPot); int pulseWidth =

map(iVal, 0, 1023, 700, 2300);

servoM1.writeMicroseconds(pulseWidth);

delay(100);

You might also like