RGB LED Screen - Neopixel Tutorial

This tutorial is about programming the RGB LED Screen using the Neopixel extension.

Effects such as lighting up the whole screen with single or multiple colours, lighting up just a range or marquee effects.

Wiring

RGB LED Screen is used with the Robotbit, please refer to the following figures.

1. Connect the screen to the adapter.

../../_images/matrixtoadapter.jpg

2. Connect the adapter to Robotbit。

../../_images/adaptertorobotbit.png

3. For prolonged use, connect a USB power.

As power is delivered via USB, you don’t have to use the 5V pin on the adapter.

../../_images/usb1.jpg

4. Demonstration of wiring

../../_images/usbpower.jpg

LED arrangement:

The LEDs on the screen are wired in a zig zag pattern in to a rectangle, please refer to the following figures.

8x32 screen

../../_images/0832.png

../../_images/0832pixels.png

16x16 screen

../../_images/1616.png

../../_images/1616pixels.png

Makecode Coding Tutorial

../../_images/mcbanner2.png

Load the Robotbit extension.

../../_images/210.png

../../_images/126.png

Neopixel blocks:

../../_images/310.png

LED Screen Initialization:

../../_images/code16.png

Since there are 256 LEDs on the screen, we initialize a light strip with 256 LEDs.

Lighting up the whole screen.

We can light up the screen with a single colour.

../../_images/code25.png

You can select a colour from the presets.

../../_images/allred.jpg

Sample Code Download

Sample Code Link

Rainbow Effect

We can apply a rainbow effect to the screen.

../../_images/code34.png

Rainbow effect uses the HSL format.
Showing multiple colours require more power, you may need to connect the external power.

../../_images/rainbow1.jpg

Sample Code Download

Sample Code Link

Adjusting brightness

It is recommended to lower the brightness to reduce the current and to avoid damage to our eyes.

../../_images/code42.png

The brightness value ranges from 0 to 255.
Since the current is reduced, there is no need for external power.

../../_images/brightness.jpg

Sample Code Download

Sample Code Link

Lighting up a single LED

Each LED can be individualy controlled.

../../_images/code51.png

The effect only shows after using show.

../../_images/pixel.jpg

Sample Code Download

Sample Code Link

Marquee effect

Pixels can move when we use a marquee effect, there are two modes in Marquee, shift or rotate.

Effects are only shown after refreshing.

Shift mode

../../_images/code61.png

../../_images/ledmove.gif

In shift mode, the animation ends after the pixel reaches the end.

Sample Code Download

Sample Code Link

Rotate mode

../../_images/code71.png

../../_images/ledloop.gif

In rotate mode, the animation restarts after the pixel reaches the end.

Sample Code Download

Sample Code Link

Selecting a range

We can control a range of LEDs.

../../_images/code91.png

Selecting 4 LEDs starting from pixel 10. (10, 11, 12 ,13)

../../_images/ledrange.jpg

Sample Code Download

Sample Code Link

Customizing Colour

We can customize colours using RGB or HSV format.

../../_images/code81.png

../../_images/rgbhsl.gif

Sample Code Download

Sample Code Link

Extension Version and Updates

There may be updates to extensions periodically, please refer to the following link to update/downgrade your extension.

Makecode Extension Update

FAQ

Q: Why is red the only colour lit up when I try to use different colours?

A: There is not enough power.

Solution: Reduce brightness or turn on the power on the Robotbit, or connect to a USB power.

Precautions

  • Do not connect a power supply with a voltage higher than 5V.

  • Connect to a USB power supply when for prolonged use.

  • Lower the brighness when a lot of LEDs are lit.

  • This product is suitable for users aged over 14, children aged 8-14 need to be under the supervision of an adult when using this product.

  • Please refer to Kittenbot’s official guidelines before using, wiring must follow the guidelines, do not use a high power servo or motor when using this product.

  • To avoid short circuiting, do not put this product on conductive surfaces such as metal.

  • To avoid short circuiting, do not put this product in water.

  • Do not touch the exposed wires with bare hands.