[CANBus]
描述
Transmit designated data.
語法
CAN.write(val)
CAN.write(buf, len)
參數
- val: data to transmit (unsigned char variable)
- buf: data array to transmit (unsigned char array)
- len: size of array
回傳
Number of byte transmitted
範例
#include <CANBus.h> unsigned char buf[8] = {0, 1, 2, 3, 4, 5, 6, 7}; void setup() { Serial.begin(115200); CAN.begin(CAN_500KBPS); // Set CAN bus transmission speed to 500KBPS } void loop() { CAN.beginTransmission(0x00); // Set remote CAN device ID to 0x00, using standard data format CAN.write(buf, 8); // Transmit 8 bytes of data CAN.endTransmission(); // End transmission delay(10); }
參考
函式庫參考主頁面
86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。