# spinner lesson a spin the BBC micro:bit game with the input on shake #button #pressed #math #random #var #string #if #docs ### @video td/videos/spinner-0 ## Topic If (Conditionals) ## Quick Links * [activity](/microbit/lessons/spinner/activity) * [challenges](/microbit/lessons/spinner/challenges) ## Class Year 7 ## Prior learning/place of lesson in scheme of work Learn how to use an if statement 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, On Shake, Variables, Assignment Operator, Pick Random and Show LEDs. ## Documentation * **If** : [read more...](/microbit/blocks/if) * **Variables** : [read more...](/microbit/reference/variables/var) * **Assignment Operator** : [read more...](/microbit/reference/variables/assign) * **On Shake** : [read more...](/microbit/reference/input/on-gesture) * **Pick Random** : [read more...](/microbit/blocks/math) * **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) ## Extended Activity * time: 20 min. * [challenges](/microbit/lessons/spinner/challenges) ## Homework * Extended Activity: [challenges](/microbit/lessons/spinner/challenges)