i cant manage to code button 2. the 3 is done and it stamps the pshape “v”
i have to code button 2 wich should basically do the same as 3 but instead of the “v” pshape should stamp phsape “u” but i dont know how to make it work
PShape u;
PShape v;
IntList cx = new IntList();
IntList cy = new IntList();
int xpos = 250;
int ypos = 250;
int counter=0;
import processing.serial.;
import cc.arduino.;
Arduino arduino;
int count = 0;
void setup() {
size(1500, 760);
smooth();
// Prints out the available serial ports.
println(Arduino.list());
arduino = new Arduino(this, Arduino.list()[0], 57600);
// Set the Arduino digital pins as inputs.
arduino.pinMode(3, Arduino.INPUT);
arduino.pinMode(2, Arduino.INPUT);
u = loadShape(“u.svg”);
v = loadShape(“v.svg”);
}
void draw() {
if (arduino.digitalRead(2)==Arduino.HIGH) {
counter++;
}
if (counter == 1) {
//draw shape1
} else if (counter == 2) {
//draw shape2
} else if (counter == 3) {
//draw shape3
} else if (counter == 4) {
//draw shape1
} else if (counter == 5) {
counter=1;
}
// println(cx.size());
// println(arduino.analogRead(0));
if (arduino.analogRead(0)<300) {
xpos-=5;
} else if (arduino.analogRead(0)>700) {
xpos+=5;
}
if (arduino.analogRead(1)>700) {
ypos-=5;
} else if (arduino.analogRead(1)<300) {
ypos+=5;
}
//resize = map(arduino.analogRead(2),0,1023,0.1,2);
background(255);
fill(127);
for (int i = 0; i < cx.size(); i++) {
int px = cx.get(i);
int py = cy.get(i);
fill(px, py, 200);
//this one is the stamp
shape(v, px, py, 150, 150);
// shape(u, px, py, 150, 150);
}
fill(mouseX, mouseY, 200);
//this one is the cursor
shape(v, xpos, ypos, 50, 50);
// shape(u, xpos, ypos, 50, 50);
if (arduino.digitalRead(3)==Arduino.HIGH) {
cx.append(xpos);
cy.append(ypos);
}
}
THANK YOU