Skip to content

Selection and sensors

Introduction to selection & sensors

If you are teaching selection and sensors, use this guide to introduce micro:bit to your teaching.

The projects highlighted below explore the micro:bit’s inputs by using its light and sound sensors, and the accelerometer to activate outputs. It builds on understanding developed in the topic inputs and outputs and develops programs to use inputs to control outputs through the use of selection.

The projects are split into different ability levels so you can find the projects to suit your students: Getting started, Next steps and Aiming further - for more confident users.

Using micro:bit to teach the concept

Programming with the micro:bit is a great way to introduce students to develop their understanding of selection. Their understanding of how inputs can be used to trigger events is also built on when introducing pupils to sensors.

Through their exploration of the micro:bit’s inbuilt sensors, such as light, sound and temperature sensors, students will appreciate that sensors are constantly sensing changes in environmental conditions and that programs can be constructed that use these changes as a trigger.

Using the micro:bit’s sensors and replicating real-life examples supports students’ learning of selection and allows them to consider the differences between programs that respond to an input, such as pressing a button, and those that respond to a change in environmental conditions. They'll also learn the need to carry out the associated action every time this condition is met.

Developing students skills

Exploring selection in these purposeful contexts provides the opportunity for students to be introduced to control systems.

By constructing programs where outputs are generated as a result of changes in environmental conditions such as lights turning on when the light level falls below a certain value or alarms sounding when movement is sensed, students are creating actions that are carried out in the real world.

This will foster a greater appreciation for the roles that computers, particularly control systems, play in their everyday lives. Furthermore, all these purposeful and engaging learning opportunities can be provided to students using the micro:bit’s inbuilt sensors.

What students will learn

This set of micro:bit projects for teaching and learning selection and sensors supports students’ understanding of the following concepts.

Concepts covered

This topic develops the knowledge, skills and understanding of the following programming and computational thinking concepts

Programming: Debugging, Selection, Sequence, Loops / repetition

Computational thinking: Algorithms, Abstraction, Decomposition, Logical thinking, Pattern recognition

Computer systems: Control, Inputs and outputs, Simulation.

Find out the primary curriculum links for this set of micro:bit projects.

National Curriculum in England


Curriculum aims

  • can understand and apply the fundamental principles and concepts of computer science, including abstraction, logic, algorithms and data representation
  • can analyse problems in computational terms, and have repeated practical experience of writing computer programs in order to solve such problems
  • can evaluate and apply information technology, including new or unfamiliar technologies, analytically to solve problems

Students should be taught to

  • design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems;
  • solve problems by decomposing them into smaller parts use sequence, selection, and repetition in programs; work with… various forms of input and output
  • use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs


Students should be taught to:

  • use fieldwork to observe, measure, record and present the human and physical features in the local area using a range of methods including digital technologies


  • Students should be taught to:
  • make systematic and careful observations and, where appropriate, take accurate measurements using standard units, use a range of equipment, including thermometers and data loggers
  • use results to draw simple conclusions, make predictions for new values, suggest improvements and raise further questions
  • recognise some common conductors and insulators
  • recognise that environments can change and that this can sometimes pose dangers to living things

Design and technology

Students should be taught to:

  • apply their understanding of computing to program, monitor and control their products
  • understand and use electrical systems in their products [for example, series circuits incorporating switches, bulbs, buzzers and motors


Students should be taught to:

  • improvise and compose music for a range of purposes using the inter-related dimensions of music

Scotland Curriculum for Excellence

Technologies, computing science:

  • I can explore and comment on processes in the world around me making use of core computational thinking concepts and can organise information in a logical way (TCH 1-13a)
  • I understand the instructions of a visual programming language and can predict the outcome of a program written using the language (TCH 1-14a)
  • I can demonstrate a range of basic problem-solving skills by building simple programs to carry out a given task, using an appropriate language (TCH 1-15a)
  • I understand the operation of a process and its outcome. I can structure related items of information. (TCH 2-13a)
  • I can explain core programming language concepts in appropriate technical language (TCH 2-14a)
  • I can create, develop and evaluate computing solutions in response to a design challenge (TCH 2-15a)

Numeracy and mathematics:

  • I have carried out investigations and surveys, devising and using a variety of methods to gather information and have worked with others to collate, organise and communicate the results in an appropriate way (MNU 2-20b)
  • I can display data in a clear way using a suitable scale, by choosing appropriately from an extended range of tables, charts, diagrams and graphs, making effective use of technology (MTH 2-21a)


  • I can describe an electrical circuit as a continuous loop of conducting materials. I can combine simple components in a series circuit to make a game or model (SCN 1-09a)
  • I have used a range of electrical components to help to make a variety of circuits for differing purposes. I can represent my circuit using symbols and describe the transfer of energy around the circuit (SCN 2-09a)
  • I can distinguish between living and non living things. I can sort living things into groups and explain my decisions (SCN 1-01a)
  • I can explore examples of food chains and show an appreciation of how animals and plants depend on each other for food (SCN 1-02a)
  • I can identify and classify examples of living things, past and present, to help me appreciate their diversity. I can relate physical and behavioural characteristics to their survival or extinction (SCN 2-01a)
  • I can use my knowledge of the interactions and energy flow between plants and animals in ecosystems, food chains and webs. I have contributed to the design or conservation of a wildlife area (SCN 2-02a)

Expressive arts:

  • I can use my voice, musical instruments and music technology to discover and enjoy playing with sound, rhythm, pitch and dynamics.(EXA 1-17a)
  • I can use my voice, musical instruments and music technology to experiment with sounds, pitch, melody, rhythm, timbre and dynamics. (EXA 2-17a)

Northern Ireland Curriculum

Primary, using ICT across the curriculum:

  • explore - investigate, make predictions and solve problems through interaction with digital tools
  • evaluate - talk about, review and make improvements to work, reflecting on the process and outcome
  • exhibit - showcase their learning across the curriculum

Primary, the world around us:

  • design and make simple models
  • how knowledge in science supports technological inventions
  • the effect of adding components to circuits
  • the use of electricity as an energy source and the importance of using it safely
  • why materials are chosen for their use
  • the variety of living things in the world and how we can take care of them
  • how people’s actions can affect plants and animals
  • the consequences of change through investigating global issues, for example, rainforest destruction or light pollution
  • how living things rely on each other within the natural world
  • the effect of people on the natural and built environment over time

Primary, music

  • work creatively with sound by investigating, experimenting, selecting and combining sounds to express feelings, ideas, mood and atmosphere
  • work creatively with sound by creating musical stories, pictures, patterns, conversations, accompaniments and investigating ways of preserving the music they have created

Curriculum for Wales

Science and technology, computation is the foundation of our digital world:

Progression step 2:

  • I can safely use a range of tools, materials and equipment to construct for a variety of reasons.
  • I can use computational thinking techniques, through unplugged or offline activities.
  • I can create simple algorithms and am beginning to explain errors.
  • I can follow algorithms to determine their purpose and predict outcomes.
  • I am beginning to explain the importance of accurate and reliable data to ensure a desired outcome.
  • I can follow instructions to build and control a physical device.

Progression step 3:

  • I can use conditional statements to add control and decision-making to algorithms.
  • I can explain and debug algorithms.
  • I can use sensors and actuators in systems that gather and process data about the systems’ environment.

Science and technology, forces and energy provide a foundation for understanding our universe:

Progression step 3:

  • I can describe the factors that affect electrical circuits and this will enable me to change variables and predict what will happen

Science and technology, design thinking and engineering offer technical and creative ways to meet society’s needs and wants:

Progression step 2:

  • I can safely use a range of tools, materials and equipment to construct for a variety of reasons
  • I have experienced using basic prototyping techniques to improve outcomes

Progression step 3:

  • I can consider how my design proposals will solve problems and how this may affect the environment

Science and technology, the world around us is full of living things which depend on each other for survival:

Progression step 2:

  • I can recognise that what I do, and the things I use, can have an impact on my environment and on living things
  • I can explore relationships between living things, their habitats and their life cycles

Expressive arts, exploring the expressive arts is essential to developing artistic skills and knowledge and it enables learners to become curious and creative individuals:

Progression step 1:

  • I can explore and experiment with a variety of creative techniques, materials, processes, resources, tools and technologies

Progression step 2:

  • I can explore and experiment with and then select appropriate creative techniques, practices, materials, processes, resources, tools and technologies

Getting started projects

If you're just getting started with micro:bit, these projects are perfect for teaching the selection and sensors.


This project can be used to consolidate pupils’ understanding of inputs and outputs.

micro:bit showing number 9 next to a thermometer icon

What students will learn

It introduces pupils to one of the micro:bit’s sensors (temperature) and illustrates that the sensors are constantly recording changes in their environment. It also introduces the idea that the data recorded by the sensors can be used in programs as the micro:bit uses the LEDs to display the current temperature.

Sunlight sensor

This project introduces pupils to selection by using the light sensor.

micro:bit reacting to sunlight falling on it by showing a sun icon on its LED display

What students will learn

Through the use of selection, pupils will understand how the data collected by sensors can be used in the program to trigger events. They will use the light level as a condition and identify what will happen when the light level is above and below are a certain level.

Pupils will also apply their understanding of repetition when considering if they require the sensor to check environmental conditions once or if the conditions should be constantly checked so that the required actions can be carried out whenever the condition is met.

Next steps projects

For teachers feeling confident using micro:bit, these projects are a great way to teach selection and sensors to students.

Saving sea turtles

This project presents pupils with a real-life application of the micro:bit. Pupils will use the micro:bit to aid the protection of newly hatched turtles by replacing artificial lights in their environments while still making them visible to humans.

turtle image the micro:bit LED display

What students will learn

The program pupils will construct uses the micro:bit’s light sensor to monitor light levels. The data collected is used as a condition in a selection statement so that actions are carried out when the condition is met.

Pupils will make decisions on how they can best use the LEDs to meet the needs of the turtles and make use of their understanding of abstraction. They will also be able to explore the effect on the program of varying the value in the conditional statement so they ensure that the actions are carried out in the correct environmental conditions.

Sensory toy

The sensory toy project introduces pupils to the micro:bit’s accelerometer sensor.

happy face on the micro:bit LED display surrounded by speaker, ear and eye icons representing sound and sight

What students will learn

They will learn how it senses the direction of movement, rotation and speed, and use this to construct a program that uses the accelerometer as a trigger to start various outputs.

In this project, pupils will also consider the needs of the user as they will need to select and design images and sounds that will appeal to learners who require additional sensory stimulation. Pupils will understand that selection is not appropriate for this program as the outputs should only be activated by the user and that environmental conditions do not need to be constantly monitored.

Furthermore, this project provides pupils with the opportunity to experiment with the range of inputs created by the accelerometer as a way of adding additional outputs to their program. This project can be taken further by asking pupils to use the micro:bit to create a prototype of their sensor toy.

Aiming further projects

If you are confident using micro:bit in the classroom, these projects are suitable for teaching selection and sensors to students with some micro:bit experience.


The metronome project allows children to explore how inputs can be used to modify an output.

a micro:bit outputting sound next to a metronome in motion

What students will learn

Pupils will program the micro:bit to play a note followed by a pause at specific tempo through the use of a forever loop. Pupils then use the A and B buttons to control the tempo of the music with one button increasing and the other decreasing the tempo.

This program will start pupils to think about how values stored in the micro:bit can be recalled, displayed and used in a program laying the foundations for the projects in the next pathway, It’s all variable. It also offers the opportunity to develop unplugged activities to support learning by asking pupils to use instruments to act out the program and the impact of each input.

Simple door alarm

In this project, pupils will construct a program that responds to two inputs: the micro:bit’s button being pressed and a change in the environment as sensed by the micro:bit’s compass sensor (known as a magnetometer).

micro:bit showing an angry face image on its LED display next to a drawing of an open door with no entry sign on it

What students will learn

The compass sensor measures the Earth’s magnetic field but can also be used to measure the strength of a magnet’s magnet field. Changes in this magnetic field, as the magnet moves further away from the micro:bit, can be used to trigger an output. This program responds to two inputs both leading to an ouput. Pupils will need to decide whether selection needs to be used so that the conditions are constantly monitored and in doing so show their depth of understanding of this concept.

Pupils will need to test and refine their program to ensure that the alarm has the required degree of sensitivity. To do this they will need to modify the value used in their selection statement. Pupils will also need to plan how they will attach the micro:bit and magnet to the door so it operates properly and is discrete.

Finally, pupils will think about the need to reset the alarm after it has been triggered by using a button input to initialise the program. In planning and constructing this program pupils will be required to apply several computer science concepts and computational thinking approaches which makes it suitable for assessing their knowledge, skills and understanding.

You may also like