(Grade IX) Chapter 3: Block Programming
Block Programming
Block
programming is a method of programming in which programs are created by joining
graphical blocks instead of writing lines of code.
Advantages
of Block Programming
· It is easy to
learn.
· It uses
graphical blocks.
· It reduces
syntax errors.
· Blocks can be
dragged and dropped.
· It helps
beginners understand programming concepts.
· It can be used
to create games, animations and applications.
Purpose
of Block Programming
The
main purpose of block programming is to make programming simple and easy to
understand, especially for beginners.
It
helps students learn basic programming concepts such as:
· Sequence
· Decision
· Repetition
· Variables
· Events
· Operators
Block
Programming Tools
A
block programming tool is software or an online platform used to create
programs using graphical blocks.
Examples
· Scratch
· Blockly
· Code.org
· MIT App Inventor
Scratch
Scratch
is a block-based programming language and programming environment developed by
the MIT Media Lab.
It
allows users to create:
· Games
· Animations
· Stories
· Interactive projects
Features of Scratch
· It uses
graphical blocks.
· Blocks can be
joined together.
· It is easy for
beginners.
· It can create
games and animations.
· It supports
sound and images.
· It reduces
syntax errors.
Scratch
Interface
The
main parts of the Scratch interface are:
|
Part |
Description |
|
Stage |
Area
where the project runs |
|
Sprite |
Character
or object used in a project |
|
Blocks
Palette |
Contains
different programming blocks |
|
Code
Area / Scripts Area |
Area
where blocks are joined |
|
Sprite
List |
Displays
sprites used in the project |
|
Green
Flag |
Starts
the project |
|
Stop
Button |
Stops
the project |
Types
of Scratch Blocks
Scratch
provides different categories of blocks.
|
Category |
Purpose |
|
Motion |
Moves
sprites |
|
Looks |
Changes
appearance or displays messages |
|
Sound |
Plays
sounds |
|
Events |
Starts
actions |
|
Control |
Controls
repetition and decisions |
|
Sensing |
Detects
information |
|
Operators |
Performs
calculations and logical operations |
|
Variables |
Stores
data |
Lab Work
Lab assignment 1: Make the Sprite Speak
Question: Make
the sprite say "Hello, I am learning Scratch." when the green flag is
clicked.
Lab assignment 2: Move the Sprite
Question: Make
the sprite move 100 steps and then say "I moved!"
Lab assignment 3: Draw a Square
Question: Draw
a square with each side of 100 steps.
Lab assignment 4: Ask Name
Question: Ask the user for their name and display "Hello [name]!"
Example: User enters:
Ram →
Sprite says: Hello Ram
Lab assignment 5: Even or Odd
Question: Ask
the user for a number and check whether it is Eve
n or Odd.
Lab assignment 6: Simple Quiz
Question: Ask
"What is the capital city of Nepal?" — if the answer is Kathmandu,
display "Correct Answer!", otherwise display "Wrong
Answer!"
Lab assignment 7: Number Guessing Game
Question: Generate
a random number between 1 and 10. Ask the user to guess the number. Display
whether the guess is correct or wrong.
Step 1 — create a
variable first: Variables → Make a Variable → name it "secret".
Micro:bit
micro:bit is a small programmable computer board designed mainly for
learning programming and electronics.
It can be programmed using
block-based programming.
F
Features
of micro:bit
· LED display
· Buttons
· Sensors
· Bluetooth
· Pins for
connecting electronic components
· Can be
programmed using blocks
Uses
of micro:bit
It
can be used to make:
· Digital counters
· Games
· Temperature
projects
· Alarm systems
· Simple
electronic projects
Arduino
Arduino
is an open-source electronics platform used to create electronic and
interactive projects.
Arduino
boards can be programmed to control electronic components.
Uses
of Arduino
Arduino
can be used in:
· Robotics
· Automatic lights
· Sensors
· Security systems
· Home automation
· Electronic
projects
Arduino
UNO
Arduino
UNO is one of the popular Arduino boards used for learning electronics and
programming.
Main
Components of Arduino UNO
· Digital pins
· Analog pins
· USB port
· Power connector
· Microcontroller
· Reset button