Back to Course
Class 6 - Coding, AI & Robotics Course
0% Complete
0/0 Steps
-
Coding
Session 1: Introduction to Coding3 Topics -
Session 2: Backdrop, Costume, and Animation3 Topics|1 Quiz
-
Session 3: Basics of Algorithm and Flowchart3 Topics|1 Quiz
-
Session 4: Basics of Pseudocode3 Topics|1 Quiz
-
Session 5: Getting Started with Quarky3 Topics|1 Quiz
-
Session 6: Variables: The Multitaskers4 Topics|1 Quiz
-
Session 7: Arithmetic Operators4 Topics|1 Quiz
-
Session 8: Conditional Statements3 Topics|1 Quiz
-
Session 9: Logical Operators4 Topics|1 Quiz
-
Session 10: Nested Conditional Statements2 Topics|1 Quiz
-
Session 11: Loops3 Topics|1 Quiz
-
Session 12: Touch Based Piano2 Topics
-
Session 13: Criterial in Loops5 Topics|1 Quiz
-
Session 14: Catch the Fruit Game - Part 12 Topics
-
Session 15: Catch the Fruit Game - Part 22 Topics|1 Quiz
-
Artificial IntelligenceSection 16: Introduction to Artificial Intelligence3 Topics|1 Quiz
-
Session 17: Basics of Face Detection2 Topics|1 Quiz
-
Session 18: Face Expression Detection2 Topics|1 Quiz
-
Session 19: Mimic Face with Quarky1 Topic
-
Session 20: Face Filter - Part 12 Topics
-
Session 21: Face Filter - Part 22 Topics
-
RoboticsSession 22: Basics of Robotics2 Topics|1 Quiz
-
Session 23: Wirelessly Controlled Robot2 Topics
-
Session 24: Introduction to Sensors3 Topics|1 Quiz
-
Session 25: Introduction to Actuators3 Topics|1 Quiz
-
Session 26: Face Tracking with Robot2 Topics
-
Session 27: Obstacle Avoidance Robot - Part 13 Topics
-
Session 28: Obstacle Avoidance Robot - Part 22 Topics|1 Quiz
-
Session 29: Edge Detector Robot - Part 13 Topics
-
Session 30: Edge Detector Robot - Part 22 Topics|1 Quiz
-
Capstone ProjectCapstone Project
Lesson 26,
Topic 1
In Progress
Activity 1: Servo Sweep
Lesson Progress
0% Complete
In this activity, we will continually make the servo’s shaft rotate its angle by 10 degrees in both directions.
Let’s get started!
- Open PictoBlox and create a New File.
- Select the coding environment as Block Coding.
- Go to the Events palette and add the when green flag clicked block into the scripting area.
- Next, go to the Variables palette and create a variable named Angle.
- Then, place the set() to () block. From the dropdown, select the Angle variable and set the value as 0. We are initializing our servo to start from a 0 angle by adding this block.
- Now drag and drop the forever block from the Control palette.
- As we want to repeat the steps, put a repeat() block from the Events palette inside the forever block. Set the value as 18.
- After that, to change the shaft’s angle, place the change () by () block from the Variable palette inside the repeat () block.
- From the dropdown, select the Angle variable and set its value as 10 so that it can change the angle by 10 degrees.
- Now, add the set servo on () to () angle block. Next, put the Angle variable into this block.
- Next, add 0.1 seconds of delay for stability with the help of the wait block below.
- Lastly, duplicate this entire repeat block and put it right next. Change the value of the Angle variable in the change() by() block to -10. This repeat block will allow the shaft to rotate in the opposite direction.
- Save the file with the name Activity- Servo Sweep.
Our script is now ready to run!
Testing
As you can observe here, the servo shaft is moving in both directions repeatedly with a change of 10 degrees.
Assignment
Before you move on to the next lesson, a small assignment awaits you!
You must upload the PictoBlox program you created in this activity to the website. Submitting the assignment is a must in order to receive the certificate after completing the course.
Follow the steps below to upload your assignment:
- Click on Browse.
- Search and Select your saved Project file(.sb3) and Click Open.
- Click on Upload to submit the assignment.
The file type allowed is the SB3 file generated from the PictoBlox program. The maximum file size allowed is 5 MB.
Good luck!