Start a new topic

Getting more out of the display

I was reading through the forum posts, and I noticed a lot of users were wishing for more colors.

The micro:bit onboard LEDs only come in red, but I wanted to make sure everyone realized you can control their brightness.

The display.set_pixel() function takes three parameters, with the last one being a brightness value 0-9 (0 is off, 9 is maximum brightness).

As one quick example, try running the following short program on your 'bit.

from microbit import *


column = 0

while column <= 4:

    row = 0

    while row <= 4:

        display.set_pixel(column, row, 9-column)

        row += 1

    column += 1

Login or Signup to post a comment