Lesson 11 night light lesson¶
change the brightness of the @boardname@.
Topic¶
Set Brightness
Quick Links¶
- night light activity
- night light challenges
- night light quiz
- Name
- Directions
- 1. Describe what
||led:set brightness||
does ? - 2. If the picture below is the @boardname@, write the code that sets all the LEDs to full brightness and turns on all the LEDs
- 3. If the picture below is the @boardname@, write the code that sets the screen brightness to 50% (128) and turns on all the LEDs.
- 4. If the picture below is the @boardname@, write the code turns off all the LEDs.
- night light quiz answers
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¶
led.setBrightness(255)
input.onButtonPressed(Button.A, () => {})
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
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