Hi everybody.
I am working on a Processing to control WS2812 LED.
My ideal is as below.
On Processing, there will be Droplist for me to choose the effect (blink, chase ...) and 3 slide value to set R, G, B color so I set the color for the LED.
On Arduino, I use Break Case to change effects. And the LED color will be:
setPixel (Pixel, red, green, blue);
with 03 values of red, green and blue.
I'm not a professional, so I am not sure about sending data series, please give me instructions to how I can send 04 variables (3 color variables, and 1 effect variable) from Processing to Arduino.
Thank you so much.
I apologize for any mistake.
Forget about the LEDs.
You need to learn to crawl before you can walk.
You need to learn how to send bytes to the Arduino from Processing and know that you are receiving them correctly by printing the bytes to the Serial Monitor.
Which Arduino are you using?
I don't know Processing. However for receiving the data on the Arduino have a look at the examples in Serial Input Basics - simple reliable non-blocking ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.
The technique in the 3rd example will be the most reliable. It is what I use for Arduino to Arduino and Arduino to PC communication.
You can send data in a compatible format with code like this (or the equivalent in any other programming language)
Serial.print('<'); // start marker
Serial.print(value1);
Serial.print(','); // comma separator
Serial.print(value2);
Serial.println('>'); // end marker
...R