pxt-calliope/docs/reference/js/lessons/love-meter.md
2016-03-25 16:47:20 -07:00

105 lines
4.7 KiB
Markdown

# love meter 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)
* [challenges](/microbit/lessons/love-meter/challenges)
* [quiz](/microbit/lessons/love-meter/quiz)
* [quiz answers](/microbit/lessons/love-meter/quiz-answers)
* [tutorial](/microbit/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...](/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)
## 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)
* [tutorial](/microbit/lessons/love-meter/tutorial)
* [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)