[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 參考的文本是根據 知識共享署名-相同方式分享 3.0 許可證,部分文本是從 Arduino 參考 修改的。 參考中的代碼示例已發佈到公共領域。