pxt-calliope/docs/reference/led/fade-in.md
Sam El-Husseini e3975e65e5 pxt-microbit Accessibility PR (#529)
* Accessibility changes
2017-09-07 13:42:08 -07:00

829 B

Fade in

Gradually increase the LED screen brightness until the LED lights are at full brightness.

led.fadeIn(700);

Parameters

  • ms - Number; the speed by which the screen brightness is increased, expressed in milliseconds (1,000 milliseconds = 1 second). The smaller the number the faster the screen brightness increased.

Example: fading dot

The following code turns on centre LED and then gradually increases and decreases the screen brightness (the centre LED pulses 5 times):

led.plot(2, 2)
for (let i = 0; i < 5; i++) {
    led.setBrightness(0)
    led.fadeIn(100)
    basic.pause(100)
    led.fadeOut(100)
}

See also

brightness, fade out, set brightness