Tuesday, April 29, 2014

NeoPixel24 Ring

Hi there,

This is just a short post about a little JavaFX control that I've created last weekend. Some time ago I've bought a NeoPixel24 ring from Adafruit and last weekend I've started to play around with it. For those of you that don't know the NeoPixel ring, here is a little image...



As you can see it is a simple ring of RGB led's.

Connecting the NeoPixel ring to my Arduino YUN was really easy and with the help of the Adafruit NeoPixel library for Arduino it was a piece of cake to control the NeoPixel ring via code.
But I'm a Java guy and like to code Java so I was thinking about how to make use of the NeoPixel ring from my desktop machine and decided to create a JavaFX control that represents the NeoPixel ring.
Long story short...that's how it looks like...



It's not a really fancy looking control but might be useful for one or the other. First I've started to create the control from JavaFX nodes using CSS to style it but after some tests I've decided to use the Canvas node to create the control. The reason for this decision is the fact that I have to change the color of each led very often which is not the best thing to do in CSS. In Canvas this is very easy because I simply redraw the led's (and only the led's because the ring and the led frames are in a separate Canvas node) which is fast enough.
For my little test project I simply increased the no of activated led's and sent the number of active led's and the current color via MQTT to the Arduino YUN which sets the real NeoPixel ring in the same way. So I can use the NeoPixel ring as some kind of a temperature gauge.
Here is a little video that shows the result...





And if you are interested in the code of the NeoPixel24 JavaFX control, feel free to fork it on Bitbucket.


UPDATE:
Because I've ordered a NeoPixel ring 60 from Adafruit to build a little clock with it, I've also added a NeoPixel60 JavaFX control to the project on Bitbucket. To give you an idea how it looks like, here it is:



That's it for today, so keep coding...

No comments:

Post a Comment