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); // 設定 CANBus 的傳輸速度為 500KBPS
}
void loop() {
CAN.beginTransmission(0x00); // 外部 CAN device 的 ID 為 0x00,使用標準資料幀
CAN.write(buf, 8); // 送出 8 bytes 資料
CAN.endTransmission(); // 結束傳送
delay(10);
}
See also
- beginTransmission()
- write()
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.
