We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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(){}
Answers
What is your definition of
rotore()
? I can see this is your own definition. Is there some code that you forgot to include in your post?Kf
ok!
Arduino waits one second to wait the end of string. i solved sending an empty string after the first string....
i have again some problems.
the code works the firs command and didn't work if i gave a second comand, but it wors at the tird command and didn't work at the fourth. pratically it works only on the odd commands. class declaration on the bottom. i don't understand were is the error....