Processing controlling arduino.

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

That's because nothing in the loop. The Arduino just repeats the empty loop and does nothing.

But isn't processing supposed to set things on arduino?

What am I supposed to do? Didn't find any references about this. Only to processing.

Were you perhaps thinking of Firmata?

No. Processing isn't supposed to set things on arduino, but you can do it - as with C, Java, Perl, Python, ....

Link: Arduino Playground - HomePage

danimath:
No. Processing isn't supposed to set things on arduino, but you can do it - as with C, Java, Perl, Python, ....

Link: Arduino Playground - HomePage

I used that post to help me.
That example is in processing. Even if I copy it doesn't work.
That's why I'm not sure if I need to program something into the arduino too.

Yes, and did you read the bit about Firmata?

That's why I'm not sure if I need to program something into the arduino too.

Yes you do need something in the arduino.
You can use the code called Firmata, but it is not very flexible. Or better still write code in the arduino that does what exactly what you want.