LightBlue offers some features that enable you to test devices. However, with the Bean, LightBlue also offers a Sandbox view that can interact with the connected Bean. There are three different ways the Sandbox subviews can interact with the Bean. We will be exploring with the track pad view.
This project walks you through how to control a NeoPixel matrix with our LightBlue iOS application Sandbox view.
Software
* LightBlue App
* Bean Loader App for iOS
Hardware
* LightBlue Bean
* iOS device
Other Materials
- an 8×8 Neopixel NeoMatrix,
- two AA batteries with a battery holder,
- a large capacitor (1000 µF, 6.3V or higher),
- 300 to 500 Ohm resistor,
- some jumper wires.
Connect DIN on the NeoPixel to Digital 4 on the Bean with the resistor, +5V to VCC and GND to GND. Then add the capacitor across the + and – terminals of the battery and attach the wires to BAT and GND on the Bean.
To use the NeoPixel, we need an additional Arduino library. Download it here and follow these instructions. If you’re unsure how to install libraries, load up this code in Arduino, and program it on the Bean:
Open the LightBlue application and tap on your Bean. ,Tap on 'Option' on the upper right corner, choose the Sandbox view, and navigate to the X-Y trackpad. If all goes well, you should be able to control the LEDs of the NeoPixel with the trackpad, change color with the slider and change between drawing/not drawing with the checkbox.
*Line 2 & 5-8: we define a macro. The compiler can then substitute the token string for each occurrence in the source file.
*Line 3 : we initialize the NeoPixel strip.
*Line 5-8: we initialize some variables.
*Line 19-23: is the setup function. This function is executed only once during the duration of the program. We also initialize Serial communications and for the NeoPixels to be turned off.
*Line 26-55: is the loop function. This function is executed multiple times. We check the control number from the X Y trackpad and reassign some of the variables.
*Line 58-73: we set the color for the NeoPixels and turn of the NeoPixels that are not in drawing mode.
*Line 76-86: We get the color value from the slider.
Having trouble with this guide? Reach out to BeanTalk to get directed feedback from our developers and community!
Comments