# spinner lesson

a spin the BBC micro:bit game with the input on shake.

## Topic

If (Conditionals)

## Quick Links

* [activity](/microbit/lessons/spinner/activity)
* [challenges](/microbit/lessons/spinner/challenges)
* [quiz](/microbit/lessons/spinner/quiz)
* [quiz answers](/microbit/lessons/spinner/quiz-answers)
* [tutorial](/microbit/lessons/spinner/tutorial)

## Class

Year 7

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

Learn how to use an if statement **if condition do** to run code run code depending on whether a condition is true or not. We will be learning how to create a die with if statements, input on shake, a local variable, assignment operator, math random as well as simple commands such as plot image.

## Documentation

* **on shake** : [read more...](/microbit/reference/input/on-gesture)
* **variable** : [read more...](/microbit/reference/variables/var)
* **assignment operator** : [read more...](/microbit/reference/variables/assignment)
* **math random** : [read more...](/microbit/js/math)
* **If** : [read more...](/microbit/reference/logic/if)
* **show LEDs** : [read more...](/microbit/reference/basic/show-leds)

## Objectives

* learn how to run code when the BBC micro:bit is shaken, when running code in the web browser, moving the mouse quickly simulates shaking
* learn how to create a local variable as a place where you can store and retrieve data
* learn how the assignment operator is used to declare a new local variable
* learn how to declare a new local variable or update the value of a variable
* learn how to return a random number
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to show an image on the LED screen

## Progression Pathways / Computational Thinking Framework

#### Algorithms

* Designs solutions (algorithms) that use repetition and two-way  selection, ie if, then and else.(AL)
*  Uses logical reasoning to predict  outputs, showing an awareness of inputs (AL)
*  Designs solutions  by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Represents solutions using a structured notation (AL) (AB)

#### Programming & Development

* Creates programs that implement algorithms to achieve given goals (AL)
*  Declares and assigns variables(AB)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* 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)
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)

#### Information Technology

* Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution (EV)
* Makes judgements about digital content when evaluating and repurposing it for a given audience (EV) (GE)
* 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.
* [activity](/microbit/lessons/spinner/activity)
* [tutorial](/microbit/lessons/spinner/tutorial)
* [quiz](/microbit/lessons/spinner/quiz)

## Extended Activity

* time: 20 min.
* [challenges](/microbit/lessons/spinner/challenges)

## Homework

* Extended Activity: [challenges](/microbit/lessons/spinner/challenges)

