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

Lab2 A Controlling System With Servo

The document outlines a project involving a servo motor connected to an Uno board, detailing the requirements, circuit connections, and code for controlling the servo's movement. It includes specific pin layouts for the servo motor and a sample code to sweep the servo from 0 to 180 degrees. Additionally, it requests a visual representation of the team's work through pictures or video links.

Uploaded by

leducviet060305
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)
10 views3 pages

Lab2 A Controlling System With Servo

The document outlines a project involving a servo motor connected to an Uno board, detailing the requirements, circuit connections, and code for controlling the servo's movement. It includes specific pin layouts for the servo motor and a sample code to sweep the servo from 0 to 180 degrees. Additionally, it requests a visual representation of the team's work through pictures or video links.

Uploaded by

leducviet060305
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

Student ID: 23162113

Full in name: Lê Đức Việt

Group number:

click để xem video

Hoặc có thể truy cập link sau :


https://drive.google.com/file/d/15rbclPdV1dP6MbcE879UzjqzcTdN-qeF/
view?usp=sharing

A Controlling System With Servo


1. Requirement
Connect servo motor to Uno board and make it move as you wish.

2. Circuit

Servo motor SG90 pin layout:


Brown: GND pin
Red : VCC (5V) pin
Yellow: Controlling signal pin
3. Install library for servo
Select the newest version and install it

4. Code the Sketch


#include <Servo.h>
int pos = 0;

Servo servo_9;

void setup()
{
servo_9.attach(9);

void loop()
{
// sweep the servo from 0 to 180 degrees in steps
// of 1 degrees
for (pos = 0; pos <= 180; pos += 1) {
// tell servo to go to position in variable 'pos'
servo_9.write(pos);
// wait 15 ms for servo to reach the position
delay(15); // Wait for 15 millisecond(s)
}
for (pos = 180; pos >= 0; pos -= 1) {
// tell servo to go to position in variable 'pos'
servo_9.write(pos);
// wait 15 ms for servo to reach the position
delay(15); // Wait for 15 millisecond(s)
}
}

Please show the your team work with picture or clip link

You might also like