I want to find...

検索

Shares

Table of Content

CAN.requestFrom()

[CANBus]

説明

Receive data from CAN bus.

構文

CAN.requestFrom()

媒介変数

None

戻り値

Number of byte received

事例

#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 received.
    {
        while (CAN.available() > 0)    // Check FIFO to see whether there are data to retrieve.
        {
            ch = CAN.read();           // Read data from FIFO.
            Serial.print(ch);          // Output data value.
            Serial.print("\t");
        }
        Serial.println();
    }
}

See also


Libraries Reference Home

86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

上部へスクロール