serialEvent question

Hello,

I am playing with serialEvent triggered by number of bytes in the buffer, it works well. within the event i would like to call another function

-------(tab serialEvent) --- 

void serialEvent(Serial port){
counter++;
}
------ (/tab serialEvent) ----

then if body od parser function is in the same tab as serialEvent it also works ok

------- (tab serialEvent) -------

void serialEvent(Serial port){
counter++
parser();
}

void parser() {
println (counter);
}

------(/tab serialEvent)  -------

but if i move parser body to separate tab it throws exception while compiling how to make it properly, to be able to separate parser in new tab

below does not work

----- (tab serialEvent) ---- 

void serialEvent(Serial port){
counter++;
parser();
}

----- (/tab serialEvent) ----


----- (tab parser) -----

void parser() {
println (counter);
}

------ (/tab parser)  ----- 

Pls advice.

br Dan

Answers

  • Answer ✓

    "it throws exception while compiling"

    Vocabulary: throwing exceptions happen at runtime, after the sketch is compiled. If that's a compilation error, that's... an error, not an exception.

    Showing the error message you get would help us in understanding your issue! In theory, moving the function to another tab should make no difference. As long as the tab has a .pde extension. A .java extension is trouble in this case...

  • Hi PhiLo,

    You are right it was error.

    I did fall back to code in separate tabs but now it compiles ok. and i cant reproduce this error.

Sign In or Register to comment.