pxt-calliope/olddocs/lessons/night-light.md

40 lines
916 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# night light lesson
2016-04-02 01:22:47 +02:00
change the brightness of the BBC micro:bit.
2016-03-26 00:47:20 +01:00
## Topic
Set Brightness
## Quick Links
2016-04-13 17:27:45 +02:00
* [activity](/lessons/night-light/activity)
* [challenges](/lessons/night-light/challenges)
* [quiz](/lessons/night-light/quiz)
* [quiz answers](/lessons/night-light/quiz-answers)
2016-03-26 00:47:20 +01:00
## Prior learning/place of lesson in scheme of work
Learn how to **set brightness** of an image `set brightness` to set the brightness of the LED screen. We will be learning how to set the brightness of the LED screen using LED show LEDs, on button pressed and set brightness.
## Documentation
2016-04-05 07:33:13 +02:00
```cards
2016-03-30 01:17:34 +02:00
led.setBrightness(255)
2016-04-05 07:33:13 +02:00
input.onButtonPressed(Button.A, () => {})
2016-03-30 01:17:34 +02:00
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
```
2016-03-26 00:47:20 +01:00
## Objectives
* learn how to set the brightness of the LED screen
* learn how to run code when an input button is pressed
* learn how to turn on all LEDs