You are on page 1of 48

An introduction to algorithms,

programming and data for Design


Technology teachers
Session 1 - sequencing and selection using
VEX / Crumble / Micro:bit
Course overview - part 1
Part 1 of this course will consist of the following sessions:

Session: Title:
Sequencing and selection using VEX / Crumble /
1
micro:bit

2 Developing solutions using VEX / Crumble / micro:bit

3 Iteration & variables using VEX / Crumble / micro:bit


Course overview - part 2
Part 2 of this course will consist of the following sessions:
Session: Title:

4 Introduction to algorithms

5 Introduction to programming

6 Introduction to data
Intended learning outcomes
By the end of this session, you will be able to:

• understand where programming fits into the Design and


Technology curriculum

• understand the key concepts of selection and sequencing

• apply programming techniques in a robotics context


Programming in the D&T Handout 1

curriculum Handout 2

Using handout 1 ‘National


Curriculum - design and technology
key stages 3’ and consider where
programming might have links with
the programme of study.

Open discussion.
Robots and robotics
Consider what &
how the robotic
lawn mower might
be having to sense?

Add your thoughts


to post-it notes.
Programming vr.vex.com

VEX VR will be used to start today's session, you can


access VEX VR by the website: vr.vex.com

You may wish to use Crumble’s / micro:bit’s later,


code will be clearly displayed on the slides for each
device.
Introduction to VEXcode VR
VEXcode VR allows you to program a robot without having to
use a physical robot.
• free to use
• no signup or login
• runs in browser - no installation
• use on desktops, laptops, tablets and Chromebooks
• code in Scratch Blocks or Python
• same programming environment as VEX 123, GO, IQ and
V5 physical robots
VEXcode VR Interface Activity 1

vr.vex.com
VEXcode VR playgrounds

vr.vex.com
Using blocks of code
Blocks of code can be used to control events. What do you
think the following blocks will control?
Making the robot move
Using the Drivetrain commands will make the robot move.

These commands have one


parameter to control the
direction.
The robot will continue to
move until another Drivetrain
command is issued.
Making the robot move
Using the Drivetrain commands will make the robot move.

These commands have one parameter to control the


direction and one to control the distance.
The program will not move on to the next command
until the distance parameter has been completed.
Making the robot move Activity 2
Making the robot move Activity 3

The instructions in a program are executed in a sequence:

• what will the robot do when


1 this program is run
2
3 • note: the instruction in the
4 sequence that is currently
5 being executed will be
6
highlighted green
Move in a square Activity 4

Modify the code to make the robot move in a square.

Remember:
• the instructions are executed in
sequence
• modify the parameters of the
commands to drive or turn for the
desired amount and direction
Move in a square
Suggested solution:
Alternative solution

In this sequence, the same two


instructions are repeated 4
times:
Using and modifying activity Activity 5
Modify activity Activity 5

Using the blocks on VEX VR and the previous activities, can


you modify the code to make the robot draw some other
geometric shapes such as a triangle, octagon, hexagon and
a pentagon for example.

Original code:
Example solutions Pentagon: Activity 5

Triangle:
Review of activities Activity 6

The code is a sequence of instructions.


That sequence of instructions is an
algorithm.

This sequence is an algorithm for


making the VEXcode VR robot move
in a square:
What does the term ‘selection’
mean to you?
Selection - IF THEN
A selection is used to make choices
depending on information.

Depending on the state or condition


of the input, programs respond by
using
IF
THEN
Selection - IF THEN

IF statements rely upon conditions to be met


When writing IF statements, break the process up:

Condition – what is
IF being checked? THEN
What will be executed if true?
Selection - IF THEN
IF statements rely upon conditions to be met
When writing IF statements, break the process up:

Fire alarm glass =


IF broken THEN
Sound fire alarm
Selection - IF THEN
IF statements can be used in VEX too
Helps to control what is happening when the program is run

IF Timer > 0 THEN


Drive forwards
Selection - IF THEN

Original: VEX:
Selection - IF THEN ELSE
A selection is used to make
choices depending on information.

Depending on the state or


condition of the input, programs
respond by using
IF
THEN or
ELSE functions
Selection - IF THEN ELSE
ELSE statements can also be used to add an alternative
option, for example:

Condition – what is
IF being checked? THEN
What will be executed if true?

If the condition is false – what


ELSE will happen?
Selection - IF THEN ELSE
ELSE statements can also be used to add an alternative option,
for example:

Fire alarm glass =


IF broken THEN
Sound fire alarm

ELSE No sounding of the fire alarm


Discussion IF/ELSE
Sensors
In order to use the selection
function within a program we must
use some form of sensor or input
device to be able to detect or
register an action.

VEXcode VR has a number of


sensors available in the toolbox.
Micro controllers
BBC micro:bit Crumble
Inputs and outputs on VEX VR
• describe what you think will happen to the robot as time
passes
• list any potential applications for a robot that moves in this
way?
IF THEN / ELSE Activity Activity 7

• construct the following code, investigate what is happening when


the program is run
• share your thoughts on post-it notes, lets discuss.

Micro:bits & Crumbles


If you wish to
investigate this code
using Crumble or
micro:bit then please
see the activity 7 in the
handout.
Review activity
In this activity you have:
• selection
• IF-THEN-ELSE
• inputs in the form of bumper
switches
• operators in the form of
some logic
NOT
AND and
pick random function
Modify activity Activity 8

Task: modify the code to make the robot ‘patrol’ FOREVER


around the perimeter of the playground.

Tips:
• use the pen down to
show the path
• use a front eye
sensor
• use an IF / THEN /
ELSE loop
Activity 8 review
Key terms in programming
In this session you have covered the key terms and
concepts of:

• selection
• sequencing and
• algorithms
How would you teach sequencing and selection to KS3 / 4
students?

What is the most challenging element of teaching


programming?
How to teach programming?

Increasing skill demand:


USE - MODIFY - CREATE
• use-modify-create teaching method
has been used in this session
• helps to break down a concept
• reduces cognitive overload as you’re
not creating a program from scratch
• scaffolding of activities
• provides students with a bank of
working programs they can use to
CREATE their own working solution
Example of USE – MODIFY - CREATE
USE: MODIFY: CREATE:
Provide ready-made Modify the ready-made Create a different
code to draw a square: code to draw a different solution, students could
shape: make use of the ready-
made code to guide
them to a solution.

For example: draw two


circles with a 50mm
gap in-between them.
Teaching programming Handout 3

How could you integrate


USE – MODIFY – CREATE
into your classroom?
Intended learning outcomes
By the end of this session, you will be able to:
• understand where programming fits into the Design and
Technology curriculum

• understand the key concepts of selection and


sequencing

• apply programming techniques in a robotics context


Thank you.

You might also like