processing problems

im getting a hard time trying to use processing with arduino, and i’m using it becuase of the communications i want to use between arduino and my computer.

the code ( in the processing program, not the arduino ) is giving me problems, and i want to see if anybody can fix it please.

import processing.serial.*;

import cc.arduino.*;

int led1 = 13;
void setup() {
  arduino = new Arduino(this, Arduino.list()[1], 57600);
  
void draw() {
  if(keyPressed) {
    if (key == 'b' || key == 'B') {
      digitalWrite(led1, HIGH);
    }
  } else {
    digitalWrite(led1, LOW);
}

the problem it’s telling me is “unexpected token :void”

i have yet to work with processing and arduino, so any help on what im doing would be great,
thanks in advance, and happy new years

There is a processing forum that you should use for this type of question.

I can see a problem though straight away - make sure you count your { and } uses - remember you need a closing bracket for every opening bracket. I'll leave it up to you to identify and make the changes!

I don't have the libraries installed, so I can't see if the code will compile all the way, but it didn't have the same complaints after I fixed the problems mentioned above.

would that cause the processor to not knowthe meaning of void?

That's not what it's saying.

You have two missing "}" . You can think of the error message as the compiler saying there is a problem in (at least) one of the functions, and that function starts with "void"

rawr, now it doesent know what "HIGH" means!

code:

import processing.serial.*;

import cc.arduino.*;

Arduino arduino;
int led1 = 13;
void setup() {
  
  arduino = new Arduino(this, Arduino.list()[1], 57600);}
void draw() {
  if(keyPressed) {
    if (key == 'b' || key == 'B') {
      digitalWrite(led1, HIGH);
    }
  } else {
    digitalWrite(led1, LOW);
} 
  
}

it's saying "HIGH was not found" and then some folders