Skip to content
Learning Site
Home

About

  • About Robotical
  • Case Studies
  • Meet the Team
  • Blog
  • Contact Us

Our Products

  • Marty the Robot
  • Axiom
  • Cog

Teach

  • Lessons & Resources
  • Marty for Educators
  • Funding & Grants
  • Professional Development
  • Why Teach STEM?
  • Coding Environments
  • Student Led Learning

Let's Code

  • Marty the Robot
  • Code Online
  • Marty Apple App
  • Marty Android App
  • Update your Marty
  • Cog
  • Code Online
  • Cog iOS App
  • Cog Android App
  • Axiom
  • Axiom Science

Support

  • Marty Get Started
  • Cog Quick Start Guide
  • Axiom Science Quick Start Guide
  • Support & FAQs
  • Marty V2 User Guides
  • Marty V1 Resources
  • Request Support
  • Request Top-Up Training

Shop

  • Marty the Robot and Physical Computing
  • Class Packs
  • Add Ons & Extras
  • Account
  • Shipping, Returns & Cancellations
  • Distributors
HomeLessonsUnits of workCurriculum standardsTutorials

Information

  • Lessons & Resources
  • Knowledge Base & User Guides
  • About Us
  • Shipping, Returns & Cancellation
  • Privacy Policy
  • Learning site privacy
  • Terms of Service
  • Partner Hub

Support & Help

  • Support & Help Center
  • Getting Started with Marty V2
  • Getting Started with Marty V1

Learning, Resources & Guides

  • Marty V2 Lessons Site
  • Marty V1 Lessons Site

Contact Us in the UK

Stanhope House,12 Stanhope Place,Edinburgh,United Kingdom,EH12 5HH
(+44) 0131 564 0922
hello@robotical.io
Contact Us

Contact Us in the US

2810N Church St, PMB 61694,Wilmington,Delaware,USA19802-4447
(+1) 833 886 1661
hello@robotical.io
Contact Us

Why not join our mailing list?

For News, New Products and Special Offers

Join mailing list

Copyright 2016-2026 © Robotical Ltd

All lessons
Marty app
CurrentPrevious

Trial Lesson Upper Elementary 60 minutes - Variables and Sensors

How can a variable affect a sensor?

Trial Lesson Upper Elementary 60 minutes - Variables and Sensors
Age / stage
8 - 10
Estimated time
60 minutes
Difficulty
Advanced
Products
Marty V2

On this page

  1. Lesson overview
  2. Before you begin
  3. Warm-up
  4. Get learning
  5. Further challenge ideas
  6. Cool down
  7. Additional reading
  8. Curriculum standards

Additional reading

  • Educator’s Guide
  • Introduction to Programming with Marty using Blocks

Curriculum standards

22
Choose your curriculum to see the relevant standards.

22 of 22 linked standards shown.

Australian CurriculumAustralia3
Curriculum areaLinked standards
Digital Technologies, Design & technologies: Design & Technologies
Digital Technologies, Design & technologies: Digital Technologies

Select a code to read the full standard.

Digital Technologies, Design & technologies: Design & Technologies

  • ACTDEP025Generate, develop and communicate design ideas and processes for audiences using appropriate technical terms and graphical representation techniques

Digital Technologies, Design & technologies: Digital Technologies

  • ACTDIP029Design algorithms represented diagrammatically and in English, and trace algorithms to predict output for a given input and to identify errors
  • ACTDIP030Implement and modify programs with user interfaces involving branching, iteration and functions in a general-purpose programming language
CSTA Education StandardsUSA2
Curriculum areaLinked standards
General standards

Select a code to read the full standard.

  • 1B-DA-05Store, copy, search, retrieve, modify, and delete information using a computing device and define the information stored as data.
  • 1B-AP-09Create programs that use variables to store and modify data.
Curriculum for ExcellenceScotland11
Curriculum areaLinked standards
Health and Wellbeing: Mental, Emotional, Social and Physical Wellbeing
Literacy & English: Listening and Talking
Literacy & English: Writing
Technologies: Computing Science
Technologies: Craft, Design, Engineering and Graphics

Select a code to read the full standard.

Health and Wellbeing: Mental, Emotional, Social and Physical Wellbeing

  • HWB 0-11a / HWB 1-11a / HWB 2-11a / HWB 3-11a / HWB 4-11Social wellbeing
  • HWB 0-14a / HWB 1-14a / HWB 2-14a / HWB 3-14a / HWB 4-14aSocial wellbeing

Literacy & English: Listening and Talking

  • LIT 2-02aTools for listening and talking
  • LIT 2-05aFinding and using information
  • LIT 2-07aUnderstanding, analysing and evaluating

Literacy & English: Writing

  • LIT 2-22aTools for writing
  • LIT 1-23aTools for writing
  • LIT 2-26aOrganising and using information

Technologies: Computing Science

  • TCH 2-13aUnderstanding the world through computational thinking
  • TCH 2-14aUnderstanding and analysing computing technology

Technologies: Craft, Design, Engineering and Graphics

  • TCH 2-12aApplication of Engineering
England's National CurriculumEngland2
Curriculum areaLinked standards
Computing, Design and Technology: Computing
Computing, Design and Technology: Design and Technology

Select a code to read the full standard.

Computing, Design and Technology: Computing

  • ✔️Understand what algorithms are; how they are implemented as programs on digital devices; and that programs execute by following precise and unambiguous instructions

Computing, Design and Technology: Design and Technology

  • ✔️Design purposeful, functional, appealing products for themselves and other users based on design criteria
ISTEUSA2
Curriculum areaLinked standards
International Society for Technology in Education (ISTE)

Select a code to read the full standard.

International Society for Technology in Education (ISTE)

  • 4dStudents exhibit a tolerance for ambiguity, perseverance and the capacity to work with open-ended problems.
  • 6bStudents create original works or responsibly repurpose or remix digital resources into new creations.
TEKSUSA2
Curriculum areaLinked standards
Elementary Technology Applications: Grade 3 to Grade 5

Select a code to read the full standard.

Elementary Technology Applications: Grade 3 to Grade 5

  • 1.CCreativity and innovation. The student uses creative thinking and innovative processes to construct knowledge and develop digital products. The student is expected to: use virtual environments to explore systems and issues.
  • 6.ATechnology operations and concepts. The student demonstrates knowledge and appropriate use of technology systems, concepts, and operations. The student is expected to: demonstrate an understanding of technology concepts, including terminology for the use of operating systems, network systems, virtual systems, and learning systems appropriate for Grades 3-5 learning;

Resources

Learner resources

  • WorkbookFile links loading

Educator resources

  • Teacher GuideFile links loading
  • Presentation for Colors and VariablesFile links loading

Lesson overview

Learners will explore events, measurements and objects that change in terms of size, value, or number over the course of time. We say that things that can change, vary. A variable is used to represent an amount, either when we are not sure what the amount is or when it can change.

Learning objectives

  • Describe what a variable is.
  • Say why some programs use variables.

Key vocabulary

  • Variables
  • Store
  • Values
  • Assign
  • Declare

Prior learning

Knowledge of block values and repeats; experience with conditional statements

Before you begin

Equipment

  • Marty the Robot v2
  • Marty Workbook
  • Tablets
  • Access to the Blocks editor

Technical information

This lesson will involve Marty walking and might be best to have Marty on the ground for all code tests.

Warm-up

Get learning

Extend

Challenge learners to think about what might happen if Marty detects a color they don't know. The two examples are 'air' and 'unclear'. Air is when there is nothing detected and unclear is when the color is not red, blue, green, purple or yellow.

Cool down

Activity

Warm-up

Share with the learners a recipe for making a cake, the video shows how to make a cake in a mug using a microwave. Some measurements use the customary, or imperial, measurement and some use metric. There is no need to focus on the measurement types, the important part is the numerical value of each measurement; however, this could lead to a discussion on conversion if it is appropriate. Each measurement shows onscreen as the video plays.

Watch on YouTube

As learners watch, have them record the values for the recipe in their workbooks. Once complete, have learners calculate how much of each ingredient would be needed for two or more cake cups, support learners with the calculations as needed, the goal is more about thinking how the recipe amounts will vary - when I have two cakes I will double the ingredients, when I have three cakes I will treble them - rather than the actual amount at the end - 2 x 3 = 6 or 1/2 x 3 = 1 1/2.

After the learners have completed the table, ask them what the variable was (the number of cakes). Reinforce that the variable is the number of cakes by explaining that as it changes, the total ingredients change but the types of ingredients for each cake do not change. The focus is not to define independent and dependent variables in this lesson, just to compute the new values for the total quantity of each ingredient.

Activity

Get Learning

The following video features Marty acting based on a variable. The variable counts the number of times a user taps a sprite in 10 seconds. Then, the program instructs Marty to take that many steps. The video below shows that the variable name is steps, this makes sense for this variable because the output will be Marty's steps. Encourage learners, when it comes to them declaring, or naming, their variables, to use a name that makes sense.

Below is a sample of Marty using a variable and the code that instructs them.

Have learners share their observations at the end. The video has this program run twice so that learners can see that the number of steps and sprite taps have both changed. The transitions are only to give Marty more screen space when walking.

Watch on YouTube

After viewing this video, have learners record the values for the variables in their workbook and attempt to recreate the code themselves.

As a whole class, it would be good to model a variable and its changing nature affecting Marty. This could be done with the tapping, as demonstrated, or it could be showcased with a loop that increases Marty's step count or arm movement. There are example code blocks in the teacher guide that you could use to display this functionality.

Time for Practice

The workbook describes the task for the learners to complete for this lesson but there is information in the presentation that is useful for first steps with variables; additionally, the information is available in the section that expands, below.

Variables have their own section in the Blocks environment. The image in the presentation (below) shows where to find the variable section and the purpose of two of the blocks.

After tapping OK, learners will see a new block called Value, which is set to 0 for just now.

This video shows learners how to find the variable section, and declare one for using with Marty, assign an initial value and change its value. This is a manual change rather than an automatic one, the earlier video of Marty walking had an automatic change. The video has no output through the physical Marty, the output is on the sprite Marty in Blocks. The video stops before the green flag is pressed, have learners suggest what the Marty sprite will 'say' Discuss with learners what the output for a physical Marty could be: number of waves, kicks, steps, degrees for a movement, time taken for a movement, basically anything that is an argument in Blocks for one of Marty's movements or looks.

Watch on YouTube

Learners need to have time to practice:

  • creating and setting a name for a variable
  • planning for how the variable will affect Marty
  • attaching the value for the variable to a different block.

The workbook offers a series of guiding questions in order to have learners design a program to make use of variables with color detection, rather than focusing on numerical values. The teacher guide shows finished examples of the code learners could create, with explanations for what is happening.

Support

Variables may still be a very new concept for learners. The connection to real world example is crucial. This lesson uses recipes, with the number of cakes being a variable.

Reinforce that the purpose of the learning is not to build a complex program with variable but rather just to describe what they are and change the declared value. Share with learners more examples of variable in their daily life to remove the stigma that 'variables are hard': learners will use and interact with variables on a daily basis without realising or thinking about it.

Some examples of variables can include:

  • money in a savings account varies as you deposit or withdraw funds, and with interest
  • how much sleep you get each night can vary based upon how full your day is, how exciting your next day will be or other factors
  • amount of homework can vary based on the day of the week, the subject, the teacher, the time of year, and other factors
Activity

Cool Down

Bring learners back together to discuss the challenges they faced and overcame. Have groups describe their creations and explain what is happening. If you can do so, model them on the trial Marty using each group's device. Encourage other groups to ask questions to deepen their understanding of the processes.

Suggested questions you might ask:

  • What values can you think of, in your daily life, which are variables? temperature, time, speed, distance, mass or weight, emotion, energy levels, etc.
  • What difference do you think there would be if there were no variables for recipes - think of different cakes that require different quantities of ingredients - butter, sugar, salt? There would only be one recipe for cake: it would be a bit boring.
  • Which type of program do you think will be more interactive, one with or without variables? A program without variables will run the same way each time, there is, by default, no interactivity: you will not change the output of the program.

Carry out any end of lesson routines.

Log off devices and clear everything away.