The potentiometer knob is used to adjust the clarity of the image display.
arduino code here
void setup() {
pinMode(6,OUTPUT);//LED
pinMode(A0,INPUT);//potentiometer
Serial.begin(9600);
}
void loop() {
int potentiometer = analogRead(A0);
if(potentiometer>512)digitalWrite(6,HIGH);
if(potentiometer<=512)digitalWrite(6,LOW);
Serial.write(potentiometer);
delay(1);
}
processing code here
import processing.serial.*;
Serial myport;
PImage image;
int m;
int n;
int step = 10;
int data = 0;
void setup() {
size(500, 500);
background(0);
image = loadImage(“233.jpg”);
//printArray(Serial.list());
myport = new Serial(this, Serial.list()[0], 9600);
}
void draw() {
while (myport.available()>0) {
data = myport.read();
println(data);
step = int(map(data, 0, 255, 0, 25));
}
background(255);
for (m = 0; m<width; m=m+step) {
for (n = 0; n<height; n = n+step) {
pushMatrix();
translate(m, n);
fill(image.get(m, n));
strokeWeight(0);
ellipse(0, 0, step, step);
//image(image,0,0,966,577);
popMatrix();
}
}
}
It is not engaging.
If I have more time, I will use several pictures to create a stop-motion animation and play base as background music. I may use ultrasonic rangefinder to adjust the volume(represent how far the audience) and when the music come to the highlighgt switch LEDs on to make music and light shows.
Leave a Reply
You must be logged in to post a comment.