To clarify from my latest test.
Typing into the Serial Monitor window does not fire the serialEvent() using the Leonardo. From what I can determine you can't use the serialEvent() on the Leonardo through USB serial, but you can use the serialEvent1() through serial on pins 0 and 1.
My test code switches on the LED, pauses 5 seconds, switches off the LED, then waits for a serial event to switch the LED back on...which never happens. Here is my code:
int led = 13;
void setup() {
// initialize serial:
Serial.begin(9600);
pinMode(led, OUTPUT);
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(5000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
}
void loop() {
delay (100);
}
void serialEvent() {
digitalWrite(led, HIGH);
}