endTransmission()

説明

CANのデータ転送。

語法


CAN.endTransmission()

パラメータ

戻り値

0:成功を表す
-1:失敗を表す

#include <CANBus.h>
unsigned char buf[8] = {0, 1, 2, 3, 4, 5, 6, 7};

void setup() {
    Serial.begin(115200);
    CAN.begin(CAN_500KBPS); //CANの送信データ速度を 500KBPSに設定する。
}

void loop() {
    CAN.beginTransmission(0x00);               // 外部CAN device の IDを0x00とし,標準データ画像を使用すること。
    CAN.write(buf, 8);                         // 8 bytesのデータを送信する
    CAN.endTransmission();                     //送信完了
}

See also

beginTransmission()
write()


Libraries Reference Home

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