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);