For this week’s exercise, I created a program that changes the color of an image based on the value sent back from Arduino. The program works like this:
The color changes smoothly because I changed the colorMode into HGB and mapped value sent back by a potentiometer, which is between 0 and 1023, into between 0 and 360.
I think this program can be used in the future to make a digital color filling book, where you choose a section and then decide what color you want to fill in this section. This may help people reduce pressure when playing with it and creat their own art work.
Here is the code on processing attached:
import processing.serial.*; PImage photo; Serial myPort; int valueFromArduino; void setup() { size(500, 413); photo = loadImage("bob.jpg"); photo.loadPixels(); printArray(Serial.list()); myPort = new Serial(this, Serial.list()[0], 9600); } void draw() { tint(valueFromArduino, 100, 100); image(photo, 0, 0); }