0% found this document useful (0 votes)
4 views3 pages

TutorialPSchematic Circuit Connection - Code

The document provides a tutorial on connecting an Arduino Uno microcontroller with a DC motor and a servo motor controlled by a potentiometer. It includes instructions for completing circuit connections and filling in code to control the servo motor's position based on the potentiometer's value. The code involves setting up input pins and mapping potentiometer values to a specific angle range for the servo motor.

Uploaded by

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

TutorialPSchematic Circuit Connection - Code

The document provides a tutorial on connecting an Arduino Uno microcontroller with a DC motor and a servo motor controlled by a potentiometer. It includes instructions for completing circuit connections and filling in code to control the servo motor's position based on the potentiometer's value. The code involves setting up input pins and mapping potentiometer values to a specific angle range for the servo motor.

Uploaded by

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

Tutorial

t
Introducti
on to

1. The schematic circuit shown below consists of an Arduino Uno


microcontroller board, a DC motor, and a 9V battery.
Complete the connections of the circuit.
Tutorial
t
Introducti
on to

2. The schematic circuit below consists of an Arduino Uno microcontroller,


a servo motor, and a potentiometer.

The potentiometer is used to control the position of the servo motor between 15
and 90 degrees, mapped with the lower and upper limit of the potentiometer
respectively.

2.a) Complete the connections of the circuit.


Tutorial
t
Introducti
on to

2.b) Fill in the blanks in the following code that is given to control the
position of the servo motor.

#include <Servo.h>

const int potentiometerPin = ____________; // Pin for the potentiometer

const int servoPin = ______________;// Pin for the servo motor

Servo myServo;

void setup() {

myServo.attach(servoPin);

________________________(______,INPUT); //Setup Input pin

void loop() {

// Read potentiometer value and map it to the servo angle range (15-120
degrees)

int potValue = ____________________ ;

int angle = map(potValue, 0,_____, 15, _____);

// Move the servo to the desired angle

myServo.write(________);

// You can add a small delay to control the servo update rate

delay(15);

You might also like