Gecko: Have flashy, blinky fun while coding!
The new wearable, codable computer that is fully compatible with the Arduino UNO programming environment
Purchase from our shop here
Learn how to:
- Flash LEDs
- Change to all the colours of the rainbow (and more)
- Listen for button presses and react how you want
What is Gecko?
- Arduino UNO compatible processor
- USB interface for power and programming
- 12 independently programmable RGB LEDs (exactly the same to program as the popular neopixels)
- 2 separate buttons for use in your programs
- Delivered with demo sequences already prepared for your delectation and delight!
How do I Program it?
- First you will need to install the drivers for the Gecko (it uses a chip called CH340G). Windows7 and above (and Ubuntu 15+) will automatically install this driver but it will take a few minutes. Plug in the Gecko and wait for Windows to install it and let you know it is done
- Install the Arduino IDE from here
- Fire up the Arduino IDE and:
- Go to the menu Sketch/Include Library/Manage Libraries../
- Search for Fastled
- Click on the box and select Install
- Copy the simple LEDtest demo from here to your Arduino sketches folder and start editing it to do what you want
Here’s the simplest, but complete program to light an LED:
First we need to include the FastLED library that we installed:
The we need must setup the data structure to store the individual LED values in. The line below creates an “array” of 12 elements, each of which has Red, Green and Blue numbers to define the separate brightness levels of each component of the pixel. Each value can be from 0 (completely OFF) to 255 (fully ON).
Arduino has 2 main functions that we need to use. The first is setup( ) which is run once at the start of the program. We set up all our initial values and things here.
The next line initialises the FastLED library to us WS2812B type LEDs connected to Arduino digital pin 13 and there are 12 LEDs in use. In the example programs the numbers 13 and 12 have been replaced by “constants” so that we can use them again and again without having to keep typing 12 for instance.
FastLED.addLeds<WS2812B, 13, RGB>(leds, 12);
After running the setup( ) function, the Arduino runs the loop( ) function repeatedly. This is where you do all the programming to make the LEDs blink on and off, or chase each other, etc. Let’s simply blink LED 6 on with blue=100 and off . Notice below that after we have changed the array to turn LED6 on (or off), we call the FastLED function show( ) . This takes the data from the array and sends it to the LEDs.
leds  = CRGB (0, 0, 100);
leds  = 0;
That’s all we need for this simple test. Let’s see what it looks like in the IDE
Now we can press the Compile and download button in the Arduino IDE – shown in orange in the screenshot above.
If all goes well, the Gecko will start flashing LED6.
Another very useful FastLED function is setBrightness( ). You can use this to change the overall brightness level of the whole display. If you don’t use this function and set an LED to 255, 255, 255 (that is, bright White) then it will be extremely bright and potentially damaging to the eyes if you stare closely at it. If you call setBrightness(40), then setting an LED to 255, 255, 255 will actually only set it to 40, 40, 40. This is stil White and quite bright, but is less damaging and will use a lot less power – important if you are using a USB battery pack.
Using the Buttons
- The buttons are on Analog pins:
- A2 (Button A)
- A1 (Button B)
- In the setup( ) function you should enable the internal pullup resistors, otherwise they will always read LOW
- pinMode(BUTTONA, INPUT_PULLUP);
- When the button is pressed, you will receive a LOW from digitalRead(BUTTONA); otherwise a HIGH
- Simple Test shown above
- Larson Scanner
- Led Test (RGB)
- Full demo – this is based on one of the FastLED library examples. Just a few changes to check for button presses etc.