# love meter blocks lesson create a love meter with the BBC micro:bit #pin #pressed #string #if #var #pause #show #docs ### @video td/videos/love-meter-0 ## Topic On Pin Pressed ## Quick Links * [activity](/microbit/lessons/love-meter/activity) * [quiz](/microbit/lessons/love-meter/quiz) * [quiz answers](/microbit/lessons/love-meter/quiz-answers) * [challenges](/microbit/lessons/love-meter/challenges) ## Class Year 7 ## Prior learning/place of lesson in scheme of work Learn how to use the **pin pressed**, `on pin pressed` to run code when the user holds the GND pin with one hand, and presses pin 0 with the other hand, thus completing a circuit. We will be learning how to create a love meter using input on pin pressed, a local variable, math random, If (conditional) as well as simple commands, such as show number, pause, and show string. ## What the teacher needs to know/QuickStart Computing Glossary * Hardware: The physical systems and components of digital devices; see also software. * 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. * Script: A computer program typically executed one line at a time through an interpreter, such as the instructions for a Scratch character. * 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 * **on pin pressed** : [read more...](/microbit/reference/input/on-pin-pressed) * **local variable** : [read more...](/microbit/reference/variables/var) * **Boolean** : [read more...](/microbit/reference/types/boolean) * **math random** : [read more...](/microbit/js/math) * **show number** : [read more...](/microbit/reference/basic/show-number) * **pause** : [read more...](/microbit/reference/basic/pause) * **If** : [read more...](/microbit/reference/logic/if) * **show string** : [read more...](/microbit/reference/basic/show-string) ## Resources * Activity: [activity](/microbit/lessons/love-meter/activity) * Activity: [quiz](/microbit/lessons/love-meter/quiz) * Extended Activity: [challenges](/microbit/lessons/love-meter/challenges) ## Objectives * learn how to run code when the user holds the GND pin in one hand, and presses pin 0 with the other hand, thus completing a circuit; when you run a script with this function in a web browser, click pin 0 on the simulator * learn how to a create a variable for a place where you can store and retrieve data * learn how Boolean operators take Boolean inputs and evaluates to a Boolean output * learn how to return a random number * learn how to show a number on the LED screen * learn how to pause your code for the specified number of milliseconds * learn how to conditionally run code depending on whether a condition is true or not * learn how to show a string on the LED screen one character at a time (scrolling from left to right) ## 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) * 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 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) * 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 * 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) * 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/love-meter/activity) * [quiz](/microbit/lessons/love-meter/quiz) ## Extended Activity * time: 20 min. * [challenges](/microbit/lessons/love-meter/challenges) ## Homework * Extended Activity: [challenges](/microbit/lessons/love-meter/challenges)