Robotics_CB_Grade8_Ebook

Page 1

About the Book This book Introduces students to the captivating realm of robotics. The book takes a learner-friendly, motivating, and hands-on approach. It combines theoretical understanding with real-world applications, while promoting creativity and problem-solving abilities in learners. Emphasizing a project-based learning methodology, the book provides a series of projects, each equipped with detailed instructions. These instructions can be effortlessly executed using the accompanying robotics hardware kit, complete with essential components and tools. The assembly and programming of the robotics system are facilitated through block-based coding and simulation environments, enabling the experiential learning journey.

Build Your Own Robots!

About Uolo Uolo partners with K-12 schools to bring technology-based learning programs. We believe pedagogy and technology must come together to deliver scalable learning experiences that generate measurable outcomes. Uolo is trusted by over 10,000 schools across India, South East Asia, and the Middle East.

hello@uolo.com �300

In partnership with Avishkaar

8

Singapore | Gurugram | Bengaluru | © 2024 Uolo EdTech Pvt. Ltd. All rights reserved.

RB_CB_Grade8_Cover.indd All Pages

22/12/23 5:43 PM



Maker Board Manual

Grade 8

UT24CB0501-20230927T070445Z-008.indd 1

12/21/2023 6:38:51 PM


Contents 1

Exploring the Hardware Kit

1

2

Experiment 1: Count till 10

8

3

Experiment 2: Calculator Using Functions

12

4

Experiment 3: Pollution Badge

22

5

Experiment 4: Digital Dice LDR

31

6

Experiment 5: Manual Boom Barrier

36

7

Experiment 6: Wandering Sprite

41

8

Practice Problems

49

ii ii

UT24CB0501-20230927T070445Z-008.indd 2

12/21/2023 6:38:52 PM


1

Exploring the Hardware Kit

Components of the Hardware Kit The Robotics kit contains the following components: 1. Maker Board

2. Air Quality Sensor

3. LDR Sensor

4. IR Sensor

5. Servo Motor

6. LEDs

7. Jumper Cable

8. Battery

1

UT24CB0501-20230927T070445Z-008.indd 1

12/21/2023 6:38:53 PM


About Maker Board Maker Board is an easy-to-use electronic platform that enables you to make innovative projects. It consists of a 5×5 RGB LED Matrix, a buzzer, four push buttons and six GPIO pins. You can bring your interesting ideas to life using the Maker Board by controlling electronic sensors and modules. You can make and play interactive games using the LED matrix and push buttons. You can make a piano, a snake game, a smart band, and many more. This board can be programmed using the Maker Studio coding interface, an easy-to-use Graphical User Interface (GUI) block-based coding platform.

Detailed Description of the Components 1. GPIO Pads

here are 4 PWM (Pulse Width Modulation) pins and 2 ADC (Analog T to Digital Converter) pins which make a total of 6 GPIO (General Purpose Input Output) pins to interface with analog and digital sensors, LEDs, motors, etc., using jumper cables and alligator clips.

2. Power Pins 1 VCC pin—This pin outputs a regulated voltage of 3.3V. 2 GND pins—Power Output (0V). 1 VIN pin—The input voltage to the Maker Board when it is using an external power source.

2

UT24CB0501-20230927T070445Z-008.indd 2

12/21/2023 6:38:54 PM


3. Programming LED Matrix n LED matrix is a grid of addressable RGB (Red, Green, and Blue) A LEDs arranged into rows and columns. In this a total of 25 addressable RGB LEDs are used which can be controlled individually. LED matrix can be used to display animations or scroll text, numbers, patterns, etc. It can also be used to make different types of 8-bit games.

4. Push Buttons here are 4 on-board push buttons named as A, S, W, and D to T perform various operations like activate, deactivate or to move the LED in different directions depending on the orientation of the LEDs. 5. Buzzer he buzzer is used to produce different sounds at distinct T frequencies and beats per minute. 6. Reset Button reset button is used to restart any program uploaded in the A Maker Board. 7. Bluetooth Module (HC-05) he Bluetooth module is there to get you started with the T possibilities of IOT and enables wireless controlling of various equipment connected to the Maker Board.

Exploring the Hardware Kit

UT24CB0501-20230927T070445Z-008.indd 3

3

12/21/2023 6:38:54 PM


8. Standoff Holes hese holes are present to ensure that the Maker Board can be T safely used on electrically conductive surfaces.

About Maker Studio Coding Interface The Maker Studio coding interface acts as an integrated development environment, that enables you to write code for all your projects. This code is then loaded into the Maker Board. The Maker Studio coding interface consists of five major components: 1. W orkspace: An area to drag and drop blocks for the code you want to write. 2. Blocks Panel: Contains all the blocks required to create your code. 3. S hare Code Option: Generate a link for the project and share it with anyone. 4. Control Buttons: Save, Compile, and Burn your code. 5. Simulator Window: Preview the output of your code.

4

UT24CB0501-20230927T070445Z-008.indd 4

12/21/2023 6:38:55 PM


Burning Your Code into the Maker Board Hardware Burning means loading your code into the Maker Board hardware. This process mainly has the following phases:

Arrange the blocks to create the code

Save the code

Compile the code

Burn the code

In case of error, recheck the code. Follow the steps given below to do so: 1. Connect the Maker Board with your PC/Laptop using a USB cable. 2. Drag and drop the colour-coded blocks to create your code. 3. Type a name for your project in the Name box. 4. Click on the Save button to save the code. 5. Click on the Compile button to compile your code.

Exploring the Hardware Kit

UT24CB0501-20230927T070445Z-008.indd 5

5

12/21/2023 6:38:55 PM


6. Now, click on the Burn button to burn your code.

7. Click on the USB Connect option.

8. C lick on the Connect Device and a small window will appear, select your connected device and click on Connect.

6

UT24CB0501-20230927T070445Z-008.indd 6

12/21/2023 6:38:57 PM


9. Now, click on Burn to burn your program into the Maker Board.

10. You have successfully loaded your code into the Maker Board hardware. Now you can perform your experiment on the Maker Board.

Exploring the Hardware Kit

UT24CB0501-20230927T070445Z-008.indd 7

7

12/21/2023 6:38:59 PM


2

Experiment 1: Count till 10

Objective

Let’s make a program to understand the programming of variables and display counting till 10 on the Maker Board.

Background Variables

• In coding, variables are objects that can be manipulated rather than just a placeholder for an unknown value.

are used to store information to be referenced and • Variables

manipulated in a computer program. They also provide a way of labelling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves.

variables as containers that hold information. Their sole • Consider

purpose is to label and store data in memory. This data can then be used throughout your program.

8

UT24CB0501-20230927T070445Z-008.indd 8

12/21/2023 6:38:59 PM


Things Around Us

Some of the real-life examples are: 1. Speed in the online game

2. Traffic signal

3. Digital wrist watch

Let’s Code 1. Click on the Control category from the Blocks panel. 2. D rag and drop the My Program block to begin your program. The execution of all the blocks present inside this occurs step by step.

Experiment 1: Count till 10

UT24CB0501-20230927T070445Z-008.indd 9

9

12/21/2023 6:39:00 PM


3. Now, create a variable named “count” using the Variables category and set its value to 1.

4. Drag the count with block having the value of “i” variable from 1 to 10 skipped by 1.

5. D isplay the value of “i” variable using the show number block from the Display category. Choose the colour of your choice from the colour palette. Set the brightness to 100. 6. D rag and drop the wait block from the Control category and type 700 in the value box.

7. Give a name to your program, save and then compile it.

10

UT24CB0501-20230927T070445Z-008.indd 10

12/21/2023 6:39:00 PM


8. N ow the program is ready to burn on the Maker Board, and you can use your digital display. Note: The Maker Board should be connected to your computer through a USB for the experiment to run.

Scan QR code to view output

Experiment 1: Count till 10

UT24CB0501-20230927T070445Z-008.indd 11

11

12/21/2023 6:39:00 PM


2

Experiment 2: Calculator Using Functions

Objective

Let’s make the Maker Board do some math and make a calculator. We will perform +, −, *, / operations on numbers depending upon which “W”, “A”, “S”, and “D” keys is pressed by the user. We will use a Maker Board for displaying the numbers.

Background 1. Button-click

• Button-click is an event that causes something to happen. • We can use these to tell programs under what circumstance(s) a particular action or set of actions should happen.

• As per input/output system, buttons are considered as input and corresponding actions are considered as output.

2. Conditionals

• Human beings (and other animals) make decisions all the time that affect their lives, for example,

a. “Should I eat one cookie or two?” b. “Should I play cricket or badminton?”

12

UT24CB0501-20230927T070445Z-008.indd 12

12/21/2023 6:39:00 PM


• Similarly, to make decisions and carry out actions accordingly in our code, we use Conditionals.

3. If block

• Conditional blocks have conditions, and the program’s flow is based on whether the condition is true or false.

• To use conditions, we use the if block.

• The if block can be taken from the Control category. If the

condition is true, then the set of code will be executed else nothing happens.

4. Flow of Control hen a function is “called”, the program “leaves” the current W section of code and begins to execute the first line inside the function. Thus, in the function “flow of control”:

he program comes to a line of code containing a “function T call”.

Experiment 2: Calculator Using Functions

UT24CB0501-20230927T070445Z-008.indd 13

13

12/21/2023 6:39:00 PM


he program enters the function (starts at the first line in the T function code).

All instructions inside the function are executed from the top • to the bottom.

The program leaves the function and goes back to where it • started from.

Any data computed and returned by the function is used in • place of the function in the original line of code.

Things Around Us

Some real-life examples are: 1. Mathematical game apps

2. Calculator app in phones

Let’s Code 1. Click on the Control category from the Blocks panel. 2. D rag and drop the My Program block to begin your program. The execution of all the blocks present inside this occurs step by step.

14

UT24CB0501-20230927T070445Z-008.indd 14

12/21/2023 6:39:01 PM


3. Create three variables named number1, number2, and result and set their values to 0 using the Variables category. Drag and drop the set to block for all three variables, as shown in the figure below.

4. Drag and drop the repeat while block from the Loops category.

5. C reate a function named “Generate num1” using the Functions category and increase the value of the number1 variable by 1 to get the desired number using the Variables category. Display the value of the number1 variable using the show number block from the Display category. To create a function, click on the Functions category and drag the to block. Replace the do something with the desired function name. The function will be created.

ote that functions are not set within the code. They are placed N separately in the workspace. You can reuse it by calling the function name in your code.

Experiment 2: Calculator Using Functions

UT24CB0501-20230927T070445Z-008.indd 15

15

12/21/2023 6:39:01 PM


6. Drag the If button block and select W key from the Button category and call the function “Generate num1”.

7. Create a function named “Generate num2” and increase the value of number2 variable value by 1 to get the desired number and then display it.

Remember

You can create a new function from an existing one by right-clicking and selecting ‘duplicate’. Then you can change the function name and other values in the value box as per your requirements.

16

UT24CB0501-20230927T070445Z-008.indd 16

12/21/2023 6:39:01 PM


8. Drag the If button block and select A key from the Button category and call the function “Generate num2”.

9. C reate a function named “Addition” and set the value of the variable result to the addition of number1 and number2 and show the result on the matrix.

Experiment 2: Calculator Using Functions

UT24CB0501-20230927T070445Z-008.indd 17

17

12/21/2023 6:39:01 PM


10. Drag the If button block and select S key, then call the function “Addition”.

Remember

Within the workspace, you can duplicate the same block and change its value as per your requirements.

11. Create a function named “Subtraction” and set the value of the result to subtraction of number1 and number2 based on which number is greater and show the result on the matrix using the if and else blocks. If the conditional statement of the if block is false, then the statement(s) of the else block will be executed. You can get the else block by clicking on the settings icon of the if block. A pop-up box appears. Drag the else block and drop it below the if block in the pop-up box.

18

UT24CB0501-20230927T070445Z-008.indd 18

12/21/2023 6:39:01 PM


12. Drag the If button block and select D key, then call the function “Subtraction”.

13. Create a function named “Multiplication” and set the value of the result to the multiplication of number1 and number2 and show the result on the matrix.

Experiment 2: Calculator Using Functions

UT24CB0501-20230927T070445Z-008.indd 19

19

12/21/2023 6:39:01 PM


14. Drag the If button block and select S key, then call the function “Multiplication” on long press.

15. Create a function named “Division” and set the value of the result to the division of number1 and number2 and show the result on the matrix.

20

UT24CB0501-20230927T070445Z-008.indd 20

12/21/2023 6:39:01 PM


16. Drag the If button block and select D key, then call the function “Division” on long press.

17. Give a name to your program, save and then compile it. 18. Now the program is ready to burn on the Maker Board, and you can use your calculator. Note: The Maker Board should be connected to your computer through a USB for the experiment to run.

Scan QR code to view output

Experiment 2: Calculator Using Functions

UT24CB0501-20230927T070445Z-008.indd 21

21

12/21/2023 6:39:01 PM


3

Experiment 3: Pollution Badge

Objective

Let’s make a Pollution Badge, sensing and measuring the pollution in the neighbouring area and displaying it on the Maker Board.

Background 1. Pollution Badge

• In today’s world, we encounter different scenarios where we see

different gases being emitted in the atmosphere through vehicles, burning of waste materials, home appliances like air conditioners and industrial chimneys.

• Monitoring of these gases is very important from a safety point of view.

• Gas sensors are very helpful in accomplishing this task, hence we are using MQ135 Gas Sensor.

• This Pollution Badge will enable us to know when the air quality is bad.

2. MQ135 Gas Sensor

• The gas sensor module consists of a steel exoskeleton under which a sensing element is housed. This sensing element is subjected to current through connecting leads.

• This current is known as heating current. Through it, the gases

coming close to the sensing element get ionised and are absorbed by the sensing element.

• This changes the resistance of the sensing element which alters the value of the current going out of it.

22

UT24CB0501-20230927T070445Z-008.indd 22

12/21/2023 6:39:01 PM


Things Around Us Some real-life examples are: 1. Air quality monitoring

2. D etection of gases like NO2, CO2, O3

Circuit

• Connect the A0 of the MQ135 sensor to the A0 of the Maker Board. • Connect the VCC of the MQ135 sensor to the VCC of the Maker Board.

• Connect the GND of the MQ135 sensor to the GND of the Maker Board.

Experiment 3: Pollution Badge

UT24CB0501-20230927T070445Z-008.indd 23

23

12/21/2023 6:39:02 PM


Let’s Code

1. Click on the Control category from the Blocks panel. 2. D rag and drop the My Program block to begin your program. The execution of all the blocks present inside this occurs step by step.

3. Drag the repeat while block from the Loops category and set its value to true. The blocks present inside this will be executed sequentially again and again till the condition is true. As soon as the condition becomes false, the working of blocks inside this loop will stop.

24

UT24CB0501-20230927T070445Z-008.indd 24

12/21/2023 6:39:02 PM


4. C reate a variable named “airQualitySensorValue”. Drag the set to block from the Variables category and drop it inside the repeat while true block. Attach the read analogue value at Channel block from the Hardware category to the set to block. Set it’s value to A0 pin status.

5. Drag the if block from the Control category and drop it below the set to block. Add the else if and else conditions to the if block (refer to the image below).

6. N ow, define the condition for the if block. If the value of variable is in between 100 and 300, then blocks under this if will be executed.

Experiment 3: Pollution Badge

UT24CB0501-20230927T070445Z-008.indd 25

25

12/21/2023 6:39:02 PM


7. D isplay a pattern using LED light of green colour from the Display category that will indicate that pollution is between a Safe range. To change the colour of squares in LED, select the colour “green” and click on each square. Set the brightness to 60. LED will look like the below figure.

26

UT24CB0501-20230927T070445Z-008.indd 26

12/21/2023 6:39:02 PM


8. D efining the condition for the first else if block. If the value of the variable is in between 300 and 600, then blocks under this else if will be executed.

9. Next display a yellow LED light pattern that will indicate that pollution is between the Unsafe range.

Experiment 3: Pollution Badge

UT24CB0501-20230927T070445Z-008.indd 27

27

12/21/2023 6:39:02 PM


10. Now, define the condition for the second else if block. If the value of the variable is between 600 and 900, then blocks under this else if will be executed.

11. Next, display a blue LED light pattern that will indicate that pollution is in the Dangerous range.

28

UT24CB0501-20230927T070445Z-008.indd 28

12/21/2023 6:39:03 PM


12. Now, define the condition for the third else if block. If the value of the variable is between 900 and 1023, then blocks under this else if will be executed.

13. Display a pattern using red colour LED light that will indicate that pollution is in the Hazardous range.

Experiment 3: Pollution Badge

UT24CB0501-20230927T070445Z-008.indd 29

29

12/21/2023 6:39:03 PM


14. Define else as clear display.

15. Give a name to your program, save and then compile it. 16. Now the program is ready to burn on the Maker Board, and you can use your pollution badge. Note: The Maker Board should be connected to your computer through a USB for the experiment to run.

Scan QR code to view output

30

UT24CB0501-20230927T070445Z-008.indd 30

12/21/2023 6:39:04 PM


5

Experiment 4: Digital Dice LDR

Objective Let’s make a digital dice using an LDR sensor (whenever light will fall on the LDR sensor, the LED matrix will show a random number from 1–6).

Background

1. LDR Light Sensor Module

• Light Dependent Resistors, LDRs, or photoresistors are electronic

components that are often used in electronic circuit designs where it is necessary to detect the presence or the level of light.

• LDRs are very different to other forms of resistors like the carbon

film resistor, metal oxide film resistor, metal film resistor and are widely used in other electronic designs. They are specifically designed for their light sensitivity and the change in resistance they cause.

• These electronic components can be described by a variety

of names from light dependent resistor (LDR), photoresistor, photoconductor, or even photocell.

31

UT24CB0501-20230927T070445Z-008.indd 31

12/21/2023 6:39:04 PM


Things Around Us Some real-life examples are: 1. Solar street lighting

2. Burglar alarm circuit

Circuit

• • •

Connect the P0 of the Maker Board with the OUT pin of the LDR sensor. onnect the GND of the Maker Board with the GND pin of the LDR C sensor.

Connect the VCC of the Maker Board with the VCC pin of the LDR sensor.

32

UT24CB0501-20230927T070445Z-008.indd 32

12/21/2023 6:39:04 PM


Let’s Code

1. Click the on the Control category from the Blocks panel. 2. D rag and drop the My Program block to begin your program. The execution of all the blocks present inside this occurs step by step.

3. Select the configure pin from the Hardware category, at the P0 pin on the Maker Board and set its direction to Input.

4. D rag and drop the repeat while block from the Loops category. The while loop is used when a function needs to be executed again and again.

Experiment 4: Digital Dice LDR

UT24CB0501-20230927T070445Z-008.indd 33

33

12/21/2023 6:39:04 PM


5. C reate a variable lightSensorValue. Set the variable “lightSensorValue” to read the status of the pin P0 from the Hardware category, as shown in the figure below.

6. C heck the condition using the if-else block, if the variable value is equal to 1 inside the if case, show a wave animation. Then, pick any random number between 1 and 6 for 3 seconds, and clear the display.

34

UT24CB0501-20230927T070445Z-008.indd 34

12/21/2023 6:39:04 PM


7. If the above condition is not true, show the clock animation.

8. Give a name to your program, save and then compile it. 9. N ow the program is ready to burn on the Maker Board, and you can use your digital dice. Note: The Maker Board should be connected to your computer through a USB for the experiment to run.

Scan QR code to view output

Experiment 4: Digital Dice LDR

UT24CB0501-20230927T070445Z-008.indd 35

35

12/21/2023 6:39:05 PM


6

Experiment 5: Manual Boom Barrier

Objective Let’s make a boom barrier using a servo motor.

Background 1. Boom Barrier

boom barrier is like a big arm that goes up and down to control A the traffic. Have you ever seen those long arms at the entrance of a parking lot or toll booth? That is called a boom barrier. he boom barrier is there to make sure cars go in and out in an T organised way. When the barrier is down, it means the cars need to stop and wait. It’s like a red light for the cars. But when the barrier goes up, it’s like a green light, and the cars can pass through. 2. Servo Motor he servo motor is a special type of motor having a shaft that can T move to a specific position and at a specific speed based on the received input. It is used in control applications and robotics. he servo motor has three main parts: a motor, a sensor, and a T controller. The motor provides the mechanical power to move or rotate the shaft. The sensors measure the position and the speed of the shaft. he controller works like the brain of the servo motor. It tells the motor T how much to move and in which direction.

36

UT24CB0501-20230927T070445Z-008.indd 36

12/21/2023 6:39:05 PM


Things Around Us Some real-life examples of servo motors are: 1. Boom Barrier

2. Automated drones

Circuit

• Connect the P0 of the Maker Board with the orange wire of the Servo motor.

• Connect the GND of the Maker Board with the brown wire of the Servo motor.

• Connect the positive terminal of the battery with the red wire of the Servo motor.

• Connect the negative terminal of the battery with the GND of the Maker Board.

Experiment 5: Manual Boom Barrier

UT24CB0501-20230927T070445Z-008.indd 37

37

12/21/2023 6:39:06 PM


Let’s Code

1. Click on the Control category from the Blocks panel. 2. D rag and drop the My Program block to begin your program. The execution of all the blocks present inside this occurs step by step.

3. D rag and drop the repeat while true block from the Loops category.

4. D rag the If button block and select the W key from the Button category, and use it inside the repeat while true block.

38

UT24CB0501-20230927T070445Z-008.indd 38

12/21/2023 6:39:06 PM


5. N ow, add move servo PWM pin block from the Hardware category in the If button block and set the P0 value to 90.

6. D rag the second If button block and use it inside the repeat while block to set the condition for button A to be pressed.

Experiment 5: Manual Boom Barrier

UT24CB0501-20230927T070445Z-008.indd 39

39

12/21/2023 6:39:06 PM


7. N ow, add the move servo PWM pin block in the If button block and set the P0 value at 0.

8. N ow the program is ready to burn on the Maker Board, and you can use your manual boom barrier. Note: The Maker Board should be connected to a power source through a USB for the experiment to run.

Scan QR code to view output

40

UT24CB0501-20230927T070445Z-008.indd 40

12/21/2023 6:39:06 PM


7

Experiment 6: Wandering Sprite

Objective Let’s make a game with sprites on the display of the Maker Board. In this game, a sprite will be put in a cage and if it tries to escape out of the cage, the game ends.

Background 1. Sprites

• Sprite is a two-dimensional bitmap that is a part of a larger scene. • Sprites can be static images or in animated form. • Sprites have location in the x and y coordinates. • The blocks of the Sprite category are used to perform various

operations related to LEDs. Sprite is a type of element which helps to develop independent animated images, text, etc., that can then be combined in a larger animation or patterns. In this category, there are blocks that help to perform different operations using these sprites.

2. Sprite Movement

• We can create a sprite, basically a character that will be displayed in the form of light that will pop on the Maker Board.

• We can set its colour and brightness. • We can make it move by steps, change direction, and set its position through x and y points.

41

UT24CB0501-20230927T070445Z-008.indd 41

12/21/2023 6:39:06 PM


Things Around Us Some real-life examples are: 1. Video games like Super Mario, Pac-Man, etc.

Let’s Code 1. Click on the Control category from the Blocks panel.

42

UT24CB0501-20230927T070445Z-008.indd 42

12/21/2023 6:39:07 PM


2. D rag the My Program block to begin your program. The execution of all the blocks present inside this occurs step by step.

3. Click on the Sprite category. 4. C lick on the Create Sprite button to create a sprite variable with your name (for example, “Sahil”).

5. D rag the draw sprite block from the Sprite category and drop it inside the My Program block. 6. Type the values of the x and y coordinates to 2 and 2, respectively. 7. Choose the colour for the sprite and set the brightness to “100”. Note: By default, Sprite faces in the right direction.

Experiment 6: Wandering Sprite

UT24CB0501-20230927T070445Z-008.indd 43

43

12/21/2023 6:39:07 PM


8. D rag the repeat while block from the Loops category and drop it below the draw sprite block.

9. D rag the If button block from the Button category and drop it inside the repeat while block to set the condition for button “W” to be pressed.

10. To ensure the sprite moves up when “W” key is pressed, follow the given steps:

• Drag the turn sprite block from the Sprite category and drop it inside the If button block.

• Turn the sprite in the “left” direction by selecting “90” degrees in the drop-down menu.

• Drag and drop the move sprite block below the turn sprite block to move the sprite by “1” step.

• Drag and drop the turn sprite block below the move sprite block. • Turn the sprite in the right direction by ”90” degrees by selecting “right” for the direction and “90” for the degrees in the drop-down.

44

UT24CB0501-20230927T070445Z-008.indd 44

12/21/2023 6:39:07 PM


11. Similarly, set actions based on different events (pressing key A or S or D) by using the If button blocks. It will allow the user to move in the left direction, S downwards and D in the right direction.

Experiment 6: Wandering Sprite

UT24CB0501-20230927T070445Z-008.indd 45

45

12/21/2023 6:39:07 PM


12. Drag the if block from the Control category and drop it below the last If button block. 13. Click on the settings icon of the if block. A pop-up box appears. 14. Drag the else if block and drop it below the if block three times in the pop-up box. 15. Now, let’s add conditions to not allow the sprite to move out of the cage. For this, set a log to restrict the sprite to not touch the top edge of the LED Matrix. Drag the touching edge block from the Sprite category and attach it to the right of the if block. 16. Drag the show scrolling text block from the Display category and drop it to the right of the do block. 17. Type “Game Over” for the text part of the block and set the colour to green from the colour palette and set the brightness to “100”. If the sprite touches the top edge, a scrolling text “Game Over” will be displayed.

46

UT24CB0501-20230927T070445Z-008.indd 46

12/21/2023 6:39:08 PM


18. Similarly, set conditions around all edges of the LED Matrix.

Experiment 6: Wandering Sprite

UT24CB0501-20230927T070445Z-008.indd 47

47

12/21/2023 6:39:08 PM


19. Give a name to your program, save and then compile it. 20. Now the program is ready to burn on the Maker Board, and you can play wandering sprite. Note: The Maker Board should be connected to your computer through a USB for the experiment to run.

Scan QR code to view output

48

UT24CB0501-20230927T070445Z-008.indd 48

12/21/2023 6:39:08 PM


8

Practice Problems

1. Make a Program to display even numbers. 2. Make a Program to display odd numbers. 3. Make a Program to display prime numbers. 4. Find the square of a number if A is pressed by the user, else find the cube of a number if D is pressed. 5. For a triangle, find its perimeter if A is pressed, find its area if W is pressed, and find its height if D is pressed. 6. Show different patterns on different values of the LDR sensor like (0 or 1). 7. Make a program for contactless door opener. 8. Try some different animations according to the received values of the IR sensor. 9. Create a sprite to move up, down, left, and right. 10. Move the sprite in all direction by taking two steps at a time.

49

UT24CB0501-20230927T070445Z-008.indd 49

12/21/2023 6:39:08 PM


About the Book This book introduces students to the captivating realm of

robotics. The book takes a learner-friendly, motivating, and hands-on approach. It combines theoretical understanding with real-world applications, while promoting creativity and problem-solving abilities in learners. Emphasizing a project-based learning methodology, the book provides a series of projects, each equipped with detailed instructions. These instructions can be effortlessly executed using the accompanying robotics hardware kit, complete with essential components and tools. The assembly and programming of the robotics system are facilitated through block-based coding and simulation environments, enabling the experiential learning journey.

Build Your Own Robots!

About Uolo Uolo partners with K-12 schools to bring technology-based learning programs. We believe pedagogy and technology must come together to deliver scalable learning experiences that generate measurable outcomes. Uolo is trusted by over 10,000 schools across India, South East Asia, and the Middle East.

hello@uolo.com �300

In partnership with Avishkaar

8

Singapore | Gurugram | Bengaluru | © 2024 Uolo EdTech Pvt. Ltd. All rights reserved.

RB_CB_Grade8_Cover.indd All Pages

26/12/23 4:13 PM


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.