# love meter lesson create a love meter with the BBC micro:bit. ### @video td/videos/love-meter-0 ## Topic On Pin Pressed ## Quick Links * [activity](/lessons/love-meter/activity) * [challenges](/lessons/love-meter/challenges) * [quiz](/lessons/love-meter/quiz) * [quiz answers](/lessons/love-meter/quiz-answers) * [tutorial](/lessons/love-meter/tutorial) ## Class Year 7 ## Prior learning/place of lesson in scheme of work Learn how to use the pins **pin pressed**, `input->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. ## Documentation * **on pin pressed** : [read more...](/reference/input/on-pin-pressed) * **local variable** : [read more...](/reference/variables/var) * **Boolean** : [read more...](/reference/types/boolean) * **math random** : [read more...](/js/math) * **show number** : [read more...](/reference/basic/show-number) * **pause** : [read more...](/reference/basic/pause) * **If** : [read more...](/reference/logic/if) * **show string** : [read more...](/reference/basic/show-string) ## 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](/lessons/love-meter/activity) * [tutorial](/lessons/love-meter/tutorial) * [quiz](/lessons/love-meter/quiz) ## Extended Activity * time: 20 min. * [challenges](/lessons/love-meter/challenges) ## Homework * Extended Activity: [challenges](/lessons/love-meter/challenges)