Documente Academic
Documente Profesional
Documente Cultură
Week 2 Lab
ECE 1020
Prof. Ahmadi
Objectives
1.
2.
Introduction to Servos
PWM Generation
There
Both
You can change the duration of the pulse to vary the servos rotation angle.
Servo
motor
Pin 4
5V
Ground
Servo
connector
{
sensorValue = analogRead(sensorPin); //read the value from the light sensor
Serial.print ("Sensor value = "); //print the sensor value to the computer screen
Serial.print(sensorValue);
Serial.println(";");
//"printLN" creates a new line
}
On your keyboard, press Ctrl+Shift+M after uploading your program to open the
serial communication dialog.
Board Layout
Pin A0
Light sensor
5V
Resistor
Ground
void setup()
{
Serial.begin(9600);
pinMode(outPin, OUTPUT);
}
Part 2 Schematic
Continuous rotation servo
Servo
connector
Servo
motor
Pin A0
5V
Resistor
Pin 5
Ground
Command Reference