I don't know what I'm doing wrong. This is the first time I'm trying to control arduino outputs with processing and nothing is happening. x.x!
Processing Code:
import processing.serial.*;
import cc.arduino.*;
Arduino ard;
int led = 22;
boolean on = false;
void setup () {
size(400, 300);
//println(Arduino.list());
ard = new Arduino(this, Arduino.list()[2], 9600); //My arduino is on COM5
ard.pinMode(led, Arduino.OUTPUT);
background(0);
}
void draw() {
if(on) {
fill(0,0,0);
} else {
fill(255,0,0);
}
rect(0,0,400,300);
}
void mouseClicked() {
if(on) {
on = false;
ard.digitalWrite(led, Arduino.LOW);
} else {
on = true;
ard.digitalWrite(led, Arduino.HIGH);
}
}
Arduino Code:
void setup() {
Serial.begin(9600);
}
void loop() {
}
Tks