Scratch with Microbit : Drawing a Square

Page 1

Drawing a Square

Introduction

Use your micro:bit to control drawing a square in Scratch.

This program uses the micro:bit’s button ‘A’ and Accelerometer to guide the pencil sprite around the screen to draw a square and clear the screen.

Drawing In Scratch

To use the drawing feature in scratch we need to add the pen extension. Go to the add extension section in the left bottom corner and then select the pen extension.
Pen Extension
Add

Pen Blocks

Once you added the pen extension you are ready to use all the pen blocks and create amazing drawing shapes.

Here is a list of all the pen blocks.

our first Drawing Project
Code
In this project we will draw a simple square using micro bit and pen blocks. Steps for Drawing a Square: ❏ Select any sprite
Go to extensions and add Microbit and Pen Extension. ❏ Resize the sprite to make it smaller.
Build the given script:

Reset and Clear Script

This script helps you to clear the stage and reset the sprite to its initial position.

Working ❏ To draw a square, Press the button ‘A’ in Microbit. ❏ Shake your micro bit to use the microbit accelerometer input to erase the drawing and set the sprite to its initial state.
Code It This Program helps us to draw a square in scratch using Microbit’s Button A.

Try It:

Try to Make a Multicolored Square in Scratch.

This time use the button “B” to erase the drawing and reset the script to its initial state.

Try to draw this given Square with the help of microbit and scratch.

Drawing a triangle

To draw a equilateral triangle using a micro bit & pen extension follow the given steps. 1. Select Any Sprite for drawing. 2. Resize the sprite to make it small or big. 3. Click Add Extension. 4. Select Pen and microbit 5. Build the given script

Script for Triangle ➔ To draw a triangle ➔ Total number of sides in a triangle = 3 ➔ Turn Angle = 360/Total Number of Sides = 360/3 = 120 Degree Reset Script

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.