SparkFun gator:bit v2 Hookup Guide

Pages
Contributors: LightningHawk, Englandsaurus
Favorited Favorite 1

Example Project: LED Animations

Installing the NeoPixel Extension for Microsoft MakeCode

Heads up! The following examples use MakeCode, which is a third party software and is therefore, subject to changes we may be unaware of. For most cases, you should be able to search the internet for information regarding the changes and how to work around them. For Example:

Previously, the libraries were referred to as MakeCode packages. They are now referred to as MakeCode extensions.
Doing a Google search for "makecode packages change", the first search result is Frequently Asked Questions - Microsoft MakeCode, which at the end of the article details that information.

To use the addressable LEDs on the gator:bit, you will need to install a MakeCode extension. Click on Advanced -> Add Extension. Search for the neopixel extension and click on the extension to add it to your list of usable extensions.

MakeCode Extensions

Example

Re-create the following code into your MakeCode editor or download the example by clicking the download button to test it out!


This program starts out with a rainbow pattern across the LEDs and then turns the LEDs off sequentially from the left. Once they have all turned off, a new animation will start sequentially from the left; the LEDs will turn blue but will fill the previous LEDs with a random color rather than turning off. The brightness is turned down to 75 to save your eyes and your battery life!