Lesson 1, Topic 1
In Progress

Code for Servo motor Copy

07/01/2021

 


Steps to do coding in Tinkercad

1. Click the code editor button to open the coding panel.










 

We will code to rotate  servo motor from 0 to 180 degree position and then from 180 to 0 degree position.

  1. First we will make a variable named as “position” to store the position of servo motor.

  2. Then we will use the “count up block” to make the servo motor rotate one by one from 0 to 180 degree position.

  3.  Now, we will put some delay and then we will use “count down block” to make the servo motor rotate in anticlockwise direction i.e. from 180 to 0 degree.

Make the code as shown below: