pxt-microbit
Version:
micro:bit target for Microsoft MakeCode (PXT)
31 lines (20 loc) • 868 B
Markdown
Create a love meter with the @boardname@.
On Pin Pressed
* [activity](/lessons/love-meter/activity)
* [quiz](/lessons/love-meter/quiz)
* [quiz answers](/lessons/love-meter/quiz-answers)
* [challenges](/lessons/love-meter/challenges)
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.
```cards
if (true) {}
input.onPinPressed(TouchPin.P0, () => {})
let x = 0
randint(0, 3)
basic.showNumber(0)
basic.pause(100)
```