[CANBus]
説明
Function to check whether there are data to read from the CAN interface’s FIFO buffer.
構文
CAN.available()
媒介変数
None
戻り値
Number of byte of data to read from the FIFO buffer.
事例
#include <CANBus.h>
unsigned char ch;
void setup() {
Serial.begin(115200);
CAN.begin(CAN_500KBPS);
}
void loop() {
if (CAN.requestFrom() > 0) // Check to see whether data is read
{
while (CAN.available() > 0) // Check FIFO to see whether there are data to be read
{
ch = CAN.read(); // Read data from FIFO
Serial.print(ch); // Output data content
Serial.print("\t");
}
Serial.println();
}
}参照
- requestFrom()
- read()
ライブラリリファレンスホーム
86Duinoリファレンスのテキストは、Arduinoリファレンスを改変したもので、Creative Commons Attribution-ShareAlike 3.0ライセンスに基づいてライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。