Hallo. My name is davide, i using processing by only 2 day. i have some problem to connect arduino with my processing code, it work but it's very slow. I control led's luminosity using PWM, (the PWM value is given by processing soft) but the time between i select the value in the soft and i see luminosity changing it's around one second (it's too much). I don't understand why.... (wich is the code command???) the code is:
import processing.serial.*;
Serial arduino;
rotore r1=new rotore("pinza");
rotore r2=new rotore(400,180,#001CBC,#E00029,"rotazione");
rotore r3=new rotore(130,500,#087708,#CB8AD1,"spalla");
rotore r4=new rotore(400,500,#FFBB00,#00F4D8,"gomito");
void setup(){
size(700,700);
arduino= new Serial(this, "COM3", 9600);
r1.disegna();
r2.disegna();
r3.disegna();
r4.disegna();
}
void mousePressed(){
r1.muovi();
String valore=String.valueOf(r1.angolo()+1000);
if(r1.dentro()==true){
arduino.write(valore);
}
r2.muovi();
valore=String.valueOf(r2.angolo()+2000);
if(r2.dentro()==true){
arduino.write(valore);
}
r3.muovi();
valore=String.valueOf(r3.angolo()+3000);
if(r3.dentro()==true){
arduino.write(valore);
}
r4.muovi();
}
void draw(){}