

fclose('all');

clear all
close all


canch1 = canChannel('PEAK-System', 'PCAN_USBBUS1');

configBusSpeed(canch1, 1000000);

start(canch1)

EID = AssembleCanID(0, 10, 0)  

messageout = canMessage(EID, true, 2);

pack(messageout,0, 0, 8, 'LittleEndian');
pack(messageout,1, 8, 8, 'LittleEndian');
transmit(canch1, messageout);

EID = AssembleCanID(2, 00, 0)  

messageout = canMessage(EID, true, 2);

pack(messageout,600, 0, 16, 'LittleEndian');

for i = 1:10*25
    transmit(canch1, messageout);
    pause(.04);
end

pack(messageout,0, 0, 8, 'LittleEndian');
pack(messageout,1, 8, 8, 'LittleEndian');
transmit(canch1, messageout);

EID = AssembleCanID(2, 00, 0)  

messageout = canMessage(EID, true, 2);

pack(messageout,200, 0, 16, 'LittleEndian');
transmit(canch1, messageout);
