You will need to install the Gemma and NeoPixel libraries. You can install both of these manually, but there is a better way. You can now download the Arduino IDE with support for NeoPixels and Gemma. Visit the Gemma tutorial for tons more information on getting started with Gemma!

Installation

Before you install the software for this project you'll need to make sure you're running the latest Arduino IDE version.  In addition you'll need to install the Adafruit NeoPixel library using either the library manager (recommended) or a manual installation.

Once you have the Arduino IDE and NeoPixel library setup, click the button below to download the Arduino sketches for this project from their home on GitHub:

You can download two Arduino sketches:

Open the appropriate sketch in the Arduino IDE.

Strand Test Code for NeoPixels

Once that is installed, you can upload NeoPixel code to the Gemma. The code below is probably what you want to start with. It is based off of the Strand Test code for NeoPixels. This can easily be modified to any animation you want to program.

Temporarily unable to load content:

Point Sensor Code

So far our hoop will just light up all the time. Using an IR sensor and IR LED we can make the NeoPixels light up whenever we score.

The IR LED pulses out IR light (940nm wavelength) at 38KHz, same as an IR remote. The IR receiver will pick up the signal as long as it can 'see' the LED. When the basketball goes through the hoop, the sensor will say it can't see the LED any more because its blocked - thats how we know it's time to light up the LEDs.

Temporarily unable to load content:

Upload

Once you've configured the sketch for your hardware you're ready to upload it to the Gemma board.  Before you upload make sure you've setup the Arduino IDE to program Gemma.  In the Tools -> Boardmenu select the Arduino Gemma board (you can use this option even if you're using the Adafruit Gemma boards).  Also in the Tools -> Programmer menu select the USBtinyISP option.  

Make sure the Gemma's USB micro/mini connector is connected to your computer.  If your Gemma board has an on/off switch slide it into the on position.  Press the reset button on the Gemma and you should see its red light start pulsing as the bootloader waits for a sketch to be uploaded.  In the Arduino IDE press the upload button or use the Sketch -> Upload command.  After a few moments you should see the sketch uploaded to the hardware (on Linux systems you might see broken pipe errors that can be ignored).

If you receive an error be sure to read the Gemma guide and confirm you can upload a basic LED blinking sketch.

This guide was first published on Mar 11, 2014. It was last updated on Mar 11, 2014.

This page (Arduino Code) was last updated on Oct 17, 2021.

Text editor powered by tinymce.