Main Content
write
Add-On Required: This feature requires the MATLAB Support Package for Raspberry Pi Hardware add-on.
Description
write(
writes CAN messages to the bus via the CAN channel.ch
,identifier
,isExtended
,dataArray
)
write(
writes the CAN message created using the ch
,CANMessage
)canMessage
of
Vehicle Network Toolbox™ to the bus.
Examples
Transmit CAN Message
Create a Raspberry Pi object.
raspiObj = raspi("192.168.1.101","pi","raspberry");
Create a canChannel
object.
ch = canChannel(raspiObj,"can0");
Transmit messages to the CAN bus.
write(ch,123,1,1:8)
Transmit CAN Message Using Vehicle Network Toolbox
Create a Raspberry Pi object.
raspiObj = raspi("192.168.1.101","pi","raspberry");
Create a canChannel
object.
ch = canChannel(raspiObj,"can0");
Transmit messages to the CAN bus.
message = canMessage(123,false,8); message.Data = [1:8]; write(ch,message)
Input Arguments
Extended Capabilities
Version History
Introduced in R2021b
See Also
read
| disableCAN
| enableCAN
| canChannel