serialEvent()

描述

緩衝區內有可用資料時會被呼叫的 callback 函式。你可以在這個函式內用 Serial.read() 來取得緩衝區內的資料。

語法

適用所有板子:

void serialEvent(){
   //statements
}

void serialEvent1(){
   //statements
}

適用 86Duino ONE:

void serialEvent2(){
   //statements
}

void serialEvent3(){
   //statements
}

void serialEvent485(){
   //statements
}

適用 86Duino EduCake:

void serialEvent2(){
   //statements
}

void serialEvent3(){
   //statements
}

void serialEvent232(){
   //statements
}

參數

statements: 任何可用的程式碼

See also

SerialEvent Tutorial from the Arduino Examples
Serial
available()
begin()
end()
find()
findUntil()
flush()
parseFloat()
parseInt()
peek()
print()
println()
read()
readBytes()
readBytesUntil()
setTimeout()
write()


語法參考主頁面

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.