Download as pdf or txt
Download as pdf or txt
You are on page 1of 42

AI AND ROBOTICS

GARDE 3 & 4
ABOUT SUPER AI POLARIS
CLASS PLAN -TERM 2
NOVEMBER

SESSION 1: INTRODUCTION TO PROGRAMMING &


INTRODUCTION TO THE SOFTWARE
SESSION 2: CREATING ANIMATION
SESSION 3: PLAYING SOUNDS
SESSION 4: LET’S CHAT!
SESSION 1
INTRODUCTION TO PROGRAMMING &
PICTOBLOX SOFTWARE
HOW DOES TRAFFIC SIGNAL WORK?
Have you ever wondered how traffic signals function?
The traffic signals have 4 states:
No Lights
Red Light – STOP
Yellow Light – LOOK
Green Light – GO

The lights cycle through green, yellow, and red at regular intervals to control road intersections’
traffic flow.
The traffic signals work in sync to prevent accidents and help to avoid congestion on the roads.
HOW DOES TRAFFIC SIGNAL WORK? -
BEHIND THE SCENES
Few lines of code running in the background drive the traffic lights. The code
changes the traffic signals to show different colors at regular intervals.

Sometimes it is even smarter, where the code detects


congestion based on sensors and maximizes efficiency by only
functioning when traffic is present.
APPLICATION OF CODING
Interaction with bar-code scanners at shopping store
Automatic control of traffic using traffic lights
Booking movie, bus, train, flight tickets online
Printers
Computer software we use like web browser, Word, etc.
Video games and animations for entertainment
WHAT IS A PROGRAM?
A program is a set of instructions that a computer follows
to complete a task. The computer receives the information,
handles it, utilizes it, and then gives an output based on it
by following a program.
STEPS IN CODING
Planning the program
Writing the program in a programming
language into a code
Testing and debugging the program
PICTOBLOX: AN INTRODUCTION
PictoBlox is a graphical programming software based on Scratch blocks and is the ideal
companion for setting the first step into the world of programming.
PICTOBLOX INTERFACE
SESSION 2 :
CREATING ANIMATION
WHAT IS A BACKDROP?
A backdrop is one of the many frames, or backgrounds, that a Stage can have. The Stage
can change its look to any of its backdrops.

Choosing a Backdrop Open PictoBlox and create a New File.


You can choose a backdrop Select the coding environment as Block
from the backdrop library Coding.
uploading a file from the Click Choose the Backdrop and select
computer any backdrop you want.
creating one using the paint
editor Choose Backdrop
COSTUMES
A costume is one out of possibly many How to Create Costumes?
“frames” or alternate appearances of a There are four ways of getting a costume for a sprite or stage.
sprite. Sprites can change their look to From the costume library
any of their costumes. Every sprite has Drawing one yourself using the inbuilt paint editor
at least one costume. Getting an image or multiple images from your desktop
One of the most common uses of Taking an image using a webcam

costumes is to make an animation for a


game. You can use a number of
costumes to create one single
animation.
The costumes available for the sprite
are shown in the Costume tab, next to
the Code tab on the extreme left.
ACTIVITY 1: MAKING AN
ANIMATION IN PICTOBLOX
In this activity, we are going to create animations with
costumes.
Follow the steps below:
Create a New file in PictoBlox:
Follow the step if you are working on Windows, macOS, or
Linux:
Open PictoBlox and create a new file.
Select the coding environment as Block Coding.
Click Choose the Backdrop and select any backdrop you
want. We’re choosing the Forest backdrop (to make Tobi
feel at home).
Create the script of the walking animation made in the
previous session.
To change a sprite’s costume, PictoBlox has the switch
costume to () block available in the Looks palette.
ACTIVITY 2 : MAKING AN
ANIMATION IN PICTOBLOX
SESSION 3 :
PLAYING SOUNDS
PLAYING SOUNDS
Hmm… something is missing from our animations. Can you
guess what?
Sound! With sound, animations become more attractive.
Let’s see how you can add sound to your animations.
What is Sound?
A sound is something that you hear when someone speaks,
sings, or plays a musical instruments. It can be played,
available by importing, built-in sound library, or recording.
In PictoBlox, you can play different sounds by using blocks
from the Sound palette which can control a sound’s
volume, tempo, and more.
ACTIVITY 1 : PLAYING SOUNDS
In this activity, we’ll make an animation of a barking dog in
which whenever we press the spacebar, the dog will bark
and go to a random location on the stage.
Follow the steps below:
Create a New file in PictoBlox:
Follow the step if you are working on Windows, macOS, or
Linux:
Open PictoBlox and create a new file.
Select the coding environment as Block Coding.
Click the Choose a Backdrop button. Select the Jungle
backdrop from the library.
Using choose a sprite button, Choose the Dog1.
Right-click on the Tobi icon in the sprite palette and
delete it.
SESSION 4
LET’S CHAT
LET’S CHAT
What if your sprite could talk to you or your friend? Let’s find
out how!
Asking a question
To make the sprite ask a question, we will use an ask block
from the Sensing palette. It will ask the user whatever you
write inside it, wait for user input, and then store that input
in the answer block.
Switching costume
Costume: A costume is one out of possibly many “frames” or
alternate appearances of a sprite. Sprites can change their
look to any of their costumes. Every sprite has at least one
costume. One of the most common uses of costumes is to
make an animation for a game. You can use a number of
costumes to create one single animation. The costumes
available for the sprite are shown in the Costume tab, next
to the python tab on the extreme left.
ACTIVITY 1 : LET’S CHAT
In this activity, we will learn how to ask a user to enter input and
create a script where a friendly goblin has a small chat with the user.
SESSION 5
GETTING FAMILIAR
WITH KIT
GETTING FAMILIAR WITH QUARKY
Quarky is going to be your friend throughout this adventurous journey. So it’s
better that you get to know about him. In this lesson, we will do the same.
GETTING FAMILIAR WITH QUARKY
Quarky: Your AI Learning Buddy
Quarky is an electronic board with a lot of features using which you can make numerous exciting
projects. You can program Quarky to make expressions, play sounds, detect touch, and much more.
Let’s look at its various features.
GETTING FAMILIAR WITH QUARKY
Quarky comes with
7×5 RGB LED matrix (35 LEDs)
2 tactile switches
5 touch pins.
2 IR sensors
2 servo ports
6 Generic I/O ports
GETTING FAMILIAR WITH QUARKY
Quarky Meets PictoBlox
Follow the steps below for connecting Quarky to
PictoBlox:
First, connect Quarky to your laptop using USB cable.
Next, open PictoBlox on your desktop.
After that, select Block Coding as your coding
environment.
Then, click the Board button in the toolbar and select
board as Quarky.
Next, select the appropriate Serial port if the Quarky is
connected via USB or the Bluetooth Port if you want to
connect Quarky via Bluetooth and press Connect.
And voila! Quarky is now connected to PictoBlox.
SESSION 6
STORY MAKING - ONCE
UPON A TIME
STORY MAKING – ONCE UPON A TIME
Events:
Events blocks are related to various triggers in a project, or when one-part signals another to run.
Broadcast(): The block sends a broadcast throughout the whole Scratch program. Any scripts in any sprites that
are hatted with the When I Receive () block that is set to a specified broadcast will activate. This broadcast block
lets scripts send broadcasts without any waits in its script (unlike the Broadcast () and Wait block). Broadcasts
are a good way to have sprites and scripts communicate.
Broadcast() and wait: The block sends a broadcast throughout the whole Scratch project — any scripts that are
halted with the When I Receive () block and are set to the broadcast will activate. This broadcast block lets
scripts send broadcasts, and have them wait until all scripts are activated by the broadcast ends.
When I receive(): Scripts that begin with this block will be invoked once the specified broadcast has been sent
by a calling script. If a Forever block is sending the broadcast faster than the attached script can finish running,
the script will restart without reaching the blocks at the end. This can be avoided by using broadcast () and wait.
ACTIVITY
STORY MAKING – ONCE UPON A TIME
CODE FOR FOX CODE FOR LION
SESSION 7
LET’S PLAY - PART 1
LET’S PLAY - PART 1
Who doesn’t like playing games!
Events:
Events blocks are related to various triggers in a
project, or when one part signals another to run.
When()key pressed: Scripts placed underneath this
block will activate when the specified key is pressed.
In this activity, we will learn how to make a sprite move
with the keys of a keyboard? And create a game to
catch the falling apple.
LET’S PLAY - PART 1 - CODE
SESSION 8
LET’S PLAY - PART 2
LET’S PLAY - PART 2
Sensing:
Sensing blocks are associate with sprites and stage detecting
conditions.
Touching():The block checks if its sprite is touching the
mouse-pointer, edge, or another sprite. If the sprite is
touching the selected object, the block returns true; if it is not,
it returns false.
Pick random() to (): The block picks a pseudorandom number
ranging from the first given number to the second, including
both endpoints. If both numbers have no decimals, it will
report a whole number. For example, if a 1 and a 3 were
inputted, the block could return a 1, 2 or 3. If one of the
numbers has a decimal point, even .0, it reports a number with
a decimal. For example, if 0.1 and 0.14 were given, the output
will be 0.1, 0.11, 0.12, 0.13, or 0.14
LET’S PLAY - PART 2- CODE
SESSION 9
EMOTIONAL ROBOT
EMOTIONAL ROBOT
In this activity, we will explore how Quarky can create
dynamic emotions on the LED display and how to
control it with keys.
Let’s begin by first connecting Quarky to PictoBlox:
1. First, connect Quarky to your laptop using the USB
cable.
2. Open PictoBlox and create a new file. Select the
coding environment as Block Coding.
3. Select the Board as Quarky. Next, select the Serial
port to connect Quarky and press Connect.
EMOTIONAL ROBOT
Animating the Expression
The script that we just made, displays a static
expression on the matrix. How about we add some life
and animate them?
The only thing that you need to do is replace the display
() emotion block with the display () animation block
from the Display extension. Change the animation to
blink from the drop-down.
Now, run the script by clicking the green flag. And voila!
EMOTIONAL ROBOT
Forever and Ever!
The magic ingredient that can make your script run
continuously is the forever block. You’ll find it in the
Control palette. This block will run all the blocks inside
it continuously.
Let’s modify our script to run it continuously by adding
a forever block around the display () animation block.
And that’s it!
ACTIVITY: MAKING EXPRESSIONS ON
DEMAND
Create the following script to make the different
expressions, when a key is pressed on the keyboard.

You might also like