Starting from:

$30

CS341-Lab 10 Servo Motor Solved

A servomotor motor is a motor that can be set to a specific position. In manufacturing, a servomotor may control a robot arm to hold a tool in position for the required work. In a petroleum or chemical plant, a servomotor may open or close a valve controlling flow in a pipe. An artist used a bunch of servo motors to create a wooden mirror.

We will use an analog input to control the position of the servo. In this lab we will use a potentiometer (a “pot”) across +5 volts and ground (0 volts) and connect the center tap wire to the analog pin A0 which our code will read from. The center tap is controlled by the position of a knob/shaft and in each position it presents a voltage value that varies between 0 and +5 volts on the wire to the input pin. As we have seen previously, the analogRead function lets us read an int value between 0 and 1023 that corresponds to the voltage.

 

The Code

This lab won’t require you to modify the starter code. 


 

Setting Up the Hardware

 

Lab Report

Please answer the following questions in your report:

1.    With the code y = map(x, 0, 1023, 0, 180);

a.     If x is 0 what will y be?

b.    If x is 512 what will y be?

c.     If x is 768 what will y be?

More products