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.
