Here, a Leap Motion is sending data to a Processing script, which is sending that data over serial to an Arduino script, which is sending it to my Arduino Uno to control an individually-addressable RGB LED strip. If you want to do this, too, you can grab my code from GitHub.
This seems over-complicated at first, but having Processing in the mix is helpful for two reasons:
- The library that exists between Leap and Processing is well made.
- Processing excels at animation and visualization. If you do not include the Arduino+RGB LED strip, you can still use the Leap to control animations on your screen via Processing. This is very helpful for debugging, and will allow you to make sure you’re handling your input correctly before you introduce the added complications of the Arduino script and hardware. In the left photo below, the Arduino script is on the left, and the Processing script is on the right. In the right photo, Processing is running and is showing the small dot animation that moves in sync with the motion that the Leap sees.
Click the pics to see them embiggened
Here’s how the Arduino is set up:
These pics are also embiggenable by clicking.
Motion-Reactive Individually-Addressable LED Strip by Michelle Leonhart is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Based on the Leap Motion Processing and Adafruit Neopixel libraries.