Code for controlling the servo motors using potentiometer Copy
Lesson-14 ->Controlling of Servo motors using Potentiometer Copy
Code for controlling the servo motors using potentiometer Copy
Steps to do coding in Tinkercad
1. Click the code editor button to open the coding panel.
We will code to rotate the servo motor using potentiometer
First we will make a variable named as
“sensorvalue”
and store the value coming from the potentiometer in it i.e via analog pin A0.
Then we will make one more variable named as “output value” and then map value coming from the potentiomter in the range 0 to 0 to 180.
Now, we will use rotate servo pin block to rotate the servo motor as per the change in resistance of potentiometer.
Make the code as shown below:
Back to Lesson
Login
Accessing this course requires a login. Please enter your credentials below!
Username or Email Address
Password
Remember Me
Lost Your Password?
Register
Don't have an account? Register one!
Register an Account