[CANBus]
Description
Transmit designated data.
Syntax
CAN.write(val)
CAN.write(buf, len)
Parameters
- val: data to transmit (unsigned char variable)
- buf: data array to transmit (unsigned char array)
- len: size of array
Returns
Number of byte transmitted
Examples
#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); }
See also
Libraries Reference Home
The text of the 86Duino reference is a modification of the Arduino reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.