pxt-calliope/docs/lessons/flashing-heart.md

50 lines
1.1 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# flashing heart blocks lesson
Learn how to create LED images with a global variable. #LED #screen #plot #docs
### @video td/videos/flashing-heart-0
## Topic
Pause
## Quick links
* [activity](/microbit/lessons/flashing-heart/activity)
* [quiz](/microbit/lessons/flashing-heart/quiz)
* [quiz answers](/microbit/lessons/flashing-heart/quiz-answers)
* [challenges](/microbit/lessons/flashing-heart/challenges)
## Prior learning/place of lesson in scheme of work
Learn how to `show LEDs` by showing an image on the LED screen. We will be learning how to create a blinking app using a forever loop as well as simple commands, such as show LEDs, pause, and clear screen.
## Documentation
2016-03-30 00:59:00 +02:00
```docs
basic.forever(() => {
2016-03-26 00:47:20 +01:00
2016-03-30 00:59:00 +02:00
})
2016-03-26 00:47:20 +01:00
2016-03-30 00:59:00 +02:00
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
2016-03-26 00:47:20 +01:00
2016-03-30 00:59:00 +02:00
basic.pause(100)
2016-03-26 00:47:20 +01:00
2016-03-30 00:59:00 +02:00
basic.clearScreen()
2016-03-26 00:47:20 +01:00
2016-03-30 00:59:00 +02:00
```
2016-03-26 00:47:20 +01:00
2016-03-30 00:59:00 +02:00
## Objectives
2016-03-26 00:47:20 +01:00
2016-03-30 00:59:00 +02:00
* learn how to repeat code in the background forever
* learn how to show LEDs on the LED screen
* learn how to pause your code for the specified number of milliseconds
* learn how to turn off all the LED lights on the LED screen