serialEvent() in Arduino 1.0-beta1

hi everybody,

i need something like a serial-interrupt when data is received.
good news, there is a new function called serialEvent() in 1.0-beta1:
http://code.google.com/p/arduino/wiki/Arduino1

but how can i use this function?
looking at the source of HardwareSerial didn't help,
can't find a example-scetch on the www.... :~

BR, Martin

I test it. I put the serialEvent function in sketch and upload.
I opened the serial monitor and typed single character, after pressing the enter it replied.

As I understand whenever a serial data incomes the serialEvent function triggered.

void setup()
{
Serial.begin(9600);
}

void loop()
{ }
 
void serialEvent()
{
 Serial.print("got message "); 
}

Wouldn't it be more useful if you got a function called every time you receive a defined character? Something like '\n' for example, so you know you received something that needs your attention.

THX, this work's!!!

i'm new to C/C++ and currently writinig a library for rc-telemety which does some subclassing on the serial-lib
something like this example --> http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1294887041

my serial object has a function called check(), this function is called every time a byte is recived and send's the awnser.
but is there a way to 'hide' the serialEvent function (or serialEvent1...) in my lib?

BR, Martin