Lesson 4 love meter blocks lesson¶
Create a love meter with the @boardname@.
Topic¶
On Pin Pressed
Quick Links¶
- love meter blocks activity
- love meter blocks quiz
- Name
- Directions
- 1. Describe what
on pin pressed
does? - 2. Create a condition for on pin pressed (P0).
- 3. Describe what this line of code does?
- 4. Describe what adding 1 to variable x does?
- 5. Describe why you must hold ground (GND) before pressing (P0) to run a program using
on pin pressed(P0)
on the @boardname@
- love meter blocks quiz answers
- love meter blocks challenges
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.
Documentation¶
if (true) {}
input.onPinPressed(TouchPin.P0, () => {})
let x = 0
Math.randomRange(0, 3)
basic.showNumber(0)
basic.pause(100)