[Serial]
説明
Reads incoming serial data. read()
inherits from the Stream utility class.
構文
All boards:
Serial.read()
Serial1.read()
86Duino One specific:
Serial2.read()
Serial3.read()
Serial485.read()
86Duino EduCake specific:
Serial2.read()
Serial3.read()
Serial232.read()
媒介変数
None
戻り値
the first byte of incoming serial data available (or -1 if no data is available) – int
例
int incomingByte = 0; // for incoming serial data void setup() { Serial.begin(9600); // opens serial port, sets data rate to 9600 bps } void loop() { // send data only when you receive data: if (Serial.available() > 0) { // read the incoming byte: incomingByte = Serial.read(); // say what you got: Serial.print("I received: "); Serial.println(incomingByte, DEC); } }
See also
- if (Serial)
- available()
- begin()
- end()
- find()
- findUntil()
- flush()
- parseFloat()
- parseInt()
- peek()
- print()
- println()
- readBytes()
- readBytesUntil()
- setTimeout()
- write()
- serialEvent()
Language Reference Home
86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。