« Beer Garden Sound Meter -- Project 1 | Main | Midi Lab »
October 20, 2004
Serial Communication Lab--Using Pots to change RGB
For my serial communication lab, I wrote a processing program that changes the RGB values of a JPG according to potentiometer input from my board.
----
For my serial communication lab, I wrote a Processing program that changes the RGB values of a JPG according to potentiometer input from my board.
My Board:

Mapping
My processing program multiplies the RGB values in a picture by variables that are connected to the potentiometers. The potentiometers have an output between 0 and 255. Some mapping was in order to make them have a desirable effect on the pictures. After some experimentation, I decided that 0-125 would make the multiplier go between 0 and 1. For pot values between 125 and 255, the multiplier goes between 1 and 15.
Random Numbers
To create interesting visual effects, I had the multiplier fluctuate randomly. The pot input set boundaries for the random number generator. If the mapped pot input is 0, the multiplier will fluctuate between 0 and 1, if it produces 15, it will fluctuate between 1 and 15. For aesthetic reasons, 1 is always one of the boundaries.
Here's the Processing code.
Movies
In this movie I have JPG of the visible spectrum. At the start, all pots are at their midpoint. Then I move them, starting with blue, towards 0. As a result the colors start to fluctuate between 0 and their original values. After I have done that to all colors, I move the pots, starting with the red one, to their maximum values. This causes the colors to fluctuate between their original value and the maximum value allowed by Processing.
Here's another movie where I do the same thing to a more interesting picture.
Here's the Processing code.
Posted by rus200 at October 20, 2004 06:12 PM