2016-03-26 00:47:20 +01:00
# truth or dare lesson
2016-04-02 01:22:47 +02:00
create a love meter with the BBC micro:bit.
2016-03-26 00:47:20 +01:00
### @video td/videos/truth-or-dare-0
## Topic
If (Conditionals)
## Quick Links
* [activity ](/microbit/lessons/truth-or-dare/activity )
* [challenges ](/microbit/lessons/truth-or-dare/challenges )
2016-03-31 00:54:19 +02:00
* [quiz ](/microbit/lessons/truth-or-dare/quiz )
* [quiz answers ](/microbit/lessons/truth-or-dare/quiz-answers )
2016-03-26 00:47:20 +01:00
## Prior learning/place of lesson in scheme of work
Learn how to use an if statement to run code run code depending on whether a condition is true or not. We will be learning how to create the game truth or dare using input an if statement, a local variable, math random as well as simple commands, such as show string and show LEDs.
## Documentation
2016-04-05 07:33:13 +02:00
```cards
2016-03-30 01:17:34 +02:00
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
2016-04-05 07:33:13 +02:00
input.onButtonPressed(Button.A, () => {})
2016-03-30 01:17:34 +02:00
let x = 0
Math.random(3)
2016-04-05 07:33:13 +02:00
if (true) {}
2016-03-30 01:17:34 +02:00
basic.showString("Hello!")
```
2016-03-26 00:47:20 +01:00
## Objectives
* learn how to display an image on the BBC micro:bit
* learn how to run code when an input button is pressed
* learn how to a create a variable for a place where you can store and retrieve data
* learn how to declare a new local variable or update the value of a variable
* learn how to return a random number
* 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)