# flipping bird lesson

count the number of times the BBC micro:bit has been shaken.

### @video td/videos/flipping-bird-0

## Topic

Math - Modulo

## Quick Links

* [tutorial](/microbit/lessons/flipping-bird/tutorial)
* [quiz](/microbit/lessons/flipping-bird/quiz)
* [quiz answers](/microbit/lessons/flipping-bird/quiz-answers)
* [challenges](/microbit/lessons/flipping-bird/challenges)

## Class

Year 7

## Prior learning/place of lesson in scheme of work

Learn how to return the **modulus**, `math->mod` to determine if you will plot image. We will be learning how to return the modulus by using a local variable, input on shake, if (conditional), modulo, as well as simple commands such as plot image.

## What the teacher needs to know / QuickStart Computing Glossary

* Algorithm: An unambiguous set of rules or a precise step-bystep guide to solve a problem or achieve a particular objective.
* Input: Data provided to a computer system, such as via a keyboard, mouse, microphone, camera or physical sensors.
* Output: The information produced by a computer system for its user, typically on a screen, through speakers or on a printer, but possibly through the control of motors in physical systems.
* Programmable toys: Robots designed for children to use, accepting input, storing short sequences of simple instructions and moving according to this stored program.
* Program: A stored set of instructions encoded in a language understood by the computer that does some form of computation, processing input and/or stored data to generate output.
* Repetition: Executing a section of computer code a number of times as part of the program.
* Simulation: Using a computer to model the state and behaviour of real-world (or imaginary) systems, including physical or social systems; an integral part of most computer games.
* Variables: A way in which computer programs can store, retrieve or change data, such as a score, the time left, or the user’s name.

## Documentation

* **global variables** : [read more...](/microbit/js/data)
* **on shake** : [read more...](/microbit/reference/input/on-gesture)
* **if** : [read more...](/microbit/reference/logic/if)
* **math modulo** : [read more...](/microbit/js/math)
* **plot image** : [read more...](/microbit/reference/led/plot-image)

## Resources

* Activity: [tutorial](/microbit/lessons/flipping-bird/tutorial)
* Activity: [quiz](/microbit/lessons/flipping-bird/quiz)
* Extended Activity: [challenges](/microbit/lessons/flipping-bird/challenges)

## Objectives

* learn how to create a local variable as a place where you can store data, so that you can use it in your code, across functions, and in nested code blocks
* learn how to run code when the micro:bit is shaken; when running code in the browser, moving the mouse quickly simulates shaking
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to return the modulus
* learn how to display an image on the BBC micro:bit's LED screen

## Links to the National Curriculum Programmes of Study for Computing

## Progression Pathways / Computational Thinking Framework

#### Algorithms

* Designs solutions (algorithms) that use repetition and two-way  selection, ie if, then and else.(AL)
* Uses diagrams to express solutions.(AB)
*  Uses logical reasoning to predict  outputs, showing an awareness of inputs (AL)
* Shows an awareness of tasks best completed by humans or computers (EV)
*  Designs solutions  by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Recognises that different solutions exist for the same problem (AL) (AB)  Understands that iteration is the repetition of a process such as a loop (AL)
* Recognises that different algorithms exist for the same problem (AL) (GE)
* Represents solutions using a structured notation (AL) (AB)
*  Can identify similarities and differences in situations and can use these to solve problems (pattern recognition)(GE)

#### Programming & Development

* Creates programs that implement algorithms to achieve given goals (AL)
*  Declares and assigns variables(AB)
* Uses post-tested loop e.g.‘until’,and a sequence of selection statements in programs,including an if,then and else statement(AL)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Uses a variable and relational operators within a loop to govern termination (AL) (GE)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB

#### Data & Data Representation

* Understands the difference between data and information(AB)
* Uses filters or can perform single criteria searches for information.(AL)
* Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV)
* Defines data types: real numbers and Boolean (AB)

#### Hardware & Processing

* Knows that computers collect data from various input devices, including sensors and application software (AB)

#### Information Technology

* Collects, organizes, and presents data and information in digital content (AB)
* Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution (EV)
* Uses criteria to evaluate the quality of solutions, can identify improvements making some refinements to the solution, and future  solutions (EV)
* Recognises ethical issues surrounding the application of information technology beyond school.

Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation

## Activity

* time: 20 min.
* [tutorial](/microbit/lessons/flipping-bird/tutorial)
* [quiz](/microbit/lessons/flipping-bird/quiz)

## Extended Activity

* time: 20 min.
* [challenges](/microbit/lessons/flipping-bird/challenges)
* assessment opportunities: loops, plot, pause, clear screen

## Homework

* Extended Activity: [challenges](/microbit/lessons/flipping-bird/challenges)

## Intended follow on

Publish script to the classroom.

