• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • about this course
  • syllabus
  • rubric
  • labs
  • blog

HCI | TechX

August 14, 2020

hw day8-王婧怡Nancy

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.

Filed Under: blog

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Recent Posts

  • Homework Day 8 – Simon Hsieh
  • homework day 8 – Michael
  • Homework-day8-Sophie
  • Harry Hao HW DAY8
  • homework day 8 – dora

Copyright © 2025 HCI | TechX on the Brunch Pro Theme