Interactive Art [Week 8] - Interactive Button
Homework Code import processing.serial.*; Serial Port; int val; int TurnNum; int Boom; PImage img1; PImage img2; PImage img3; void setup() { size(1000, 1000); printArray(Serial.list()); Port = new Serial(this, Serial.list()[1], 9600); TurnNum = 0; Boom = (int) random(150); img1 = loadImage("1.png"); img2 = loadImage("2.png"); img3 = loadImage("3.png"); } void draw() { //background(0); if ( Port.available() > 0) { val = Port.read(); println("Button Pressed: " + val); println("Turn Num: " + TurnNum); println("Boom: " + Boom); if (TurnNum > Boom){ image(img3,0,0); } } if (val == 0){ fill(0); }else{ TurnNum = TurnNum + 1; ...