Thanks so much CrossRoads. That totally did it!
I might have already been there, but I haven't noticed the difference in the lights.
The byte value was visually not very noticeable, I had to optimize the code with some values ie for example multiplied by 3 for incomingbyte<70:
if (incomingByte < 70) {
analogWrite(rpin, incomingByte*3);
}
multiplied by 1.5 for the 70<incomingbyte<140
and no change (multiply by 1) for >140.
@ James C45
Do you want the LED's color segments to have their brightness correlated to the values you are passing from your processing sketch? If yes, then analogWrite() and PWM are your only options.
If you just want to turn on the color segments based on the value then you can use digitalWrite() and if statements.
Thanks James. That helped. When I move the mouseX, the red led lights up first gradually increasing in brightness, then after 1/3 of the screen the green one starts lighting up and then the blue. So yes, I'm using pwm.
But I think I might want to simply make them light up based on their value --> digitalWrite(). They shine brighter and might divide the area into 6 parts instead of three.
The setup I have is a live camera capture of a fish in a tank, using Processing. When the fish moves, different leds illuminate the tank. leds are very low brightness as you can imagine, finding a more powerful alternative will also be the next step.
Matjaz