error: variable or field "serialEvent" declared vo

Hello everybody,

I am not very knolageable about programming or electronics but I am trying to learn… Any help would be greatly appreciated!!!

I picked up Tom Igoes book “Making Things Talk” pg. 61 the Serial String Reader example, and I can’t figure out why i am getting this error:

error: variable or field ‘serialEvent’ declared void In function ‘void setup()’:
At global scope:

I am running the following in windows XP on an Arduino Duemilanove:

/*
Serial String Reader
Language: Processing

Reads in a string of characters from a serial port until
it gets a linefeed (ASCII 10). Then splits the string into
sections separated by commas. Then converts the sections to ints,
and prints them out.
*/

import processing.serial.*; // import the Processing serial library

int linefeed = 10; // Linefeed in ASCII
Serial myPort; // The serial port

void setup() {
// List all the available serial ports
println(Serial.list());

// I know that the first port in the serial list on my mac
// is always my Arduino module, so I open Serial.list()[0].
// Change the 0 to the appropriate number of the serial port
// that your microcontroller is attached to.
myPort = new Serial(this, Serial.list()[5], 9600);

// read bytes into a buffer until you get a linefeed (ASCII 10):
myPort.bufferUntil(linefeed);
}

void draw() {
// twiddle your thumbs
}

// serialEvent method is run automatically by the Processing applet
// whenever the buffer reaches the byte value set in the bufferUntil()
// method in the setup():

void serialEvent(Serial myPort) {
// read the serial buffer:
String myString = myPort.readStringUntil(linefeed);

// if you got any bytes other than the linefeed:
if (myString != null) {

myString = trim(myString);

// split the string at the commas
// and convert the sections into integers:
int sensors = int(split(myString, ‘,’));

// print out the values you got:
for (int sensorNum = 0; sensorNum < sensors.length; sensorNum++) {
print("Sensor " + sensorNum + ": " + sensors[sensorNum] + “\t”);
}
// add a linefeed after all the sensor values are printed:
println();
}
}

You're using the Arduino IDE to compile a Processing sketch.

If you compile it with the Processing IDE, it should be OK.

Ahhhh, yes that would make sense.....

Thank you so much for your help!