Hey,
I want to control some WS2812B leds connected to an arduino nano with a graphical user interface (preferably java), but I’m not sure how to start because I haven’t done anything with an arduino before.
For the beginng it would be enough if you can change the color and brightness of the strip, but later I want to be able to choose from additional effects like blinking or rainbow.
If you have any tips, let me hear them.
First off, take one small step at a time.
In this case, I’d leave Java for later and just learn how to do basic programming with a Nano.
Then, you could hook up your WS2812’s to the Nano, download the FastLED library and try out the examples included with it.
So I tried out some examples and they work fine so far. I wrote a programm to change the color via the serial monitor using the ArduinoSerialCommand Lib (https://github.com/scogswell/ArduinoSerialCommand). In my case I set up a command “setRGB” followed by three values for R,G and B.
But is that the best way to send commands and control the arduino?
@Ted_Miller I like to setup a "packet’ of data like this:
//PACKET STRUCTURE
struct dataStruct {
byte MENU_ID; byte BRIGHTNESS;
} packet;
So when I want to control the brightness of my controller, I assign a value to " packet.BRIGHTNESS = 255;"
To control different types of FX and animations, I use a switch case statement, that is controlled by the packet.MENU_ID:
switch (packet.MENU_ID)
{
default:
break;
case 255:
//master brightness control
LEDS.setBrightness(packet.BRIGHTNESS);
FastLED.show();
break;
case 0:
fadeToBlackBy( leds, NUM_LEDS, 2);
FastLED.show();
break;
}
@Jon_Burroughs Thank you!
Are there any good tutorials for serial communication with the arduino and java? Or would it be easier/better to use something else than java?
@Ted_Miller I’m not too keen on GUI’s and Java with Arduino, but I have seen a lot of OSC (open sound control) interfaces like this one: https://plus.google.com/104671975653102739470/posts/Bjr8n5TK3fg
you can buy ws2812b led lights and other related products from http://www.sfleds.com