send message with Peak can bus
-
@Rossano said in send message with Peak can bus:
device->connectDevice();
You should check what this returns.
If it returns false check what https://doc.qt.io/qt-5/qcanbusdevice.html#errorString tells you. -
@Rossano I'm not talking about compilation. Also how is frameWritten related to device->connectDevice()?
Please check what device->connectDevice() returns (true or false?). If it returns false check what https://doc.qt.io/qt-5/qcanbusdevice.html#errorString returns. -
does this work?
#QCanBusFrame roxFrame; #roxFrame.setFrameId(canID); #roxFrame.setFrameType(QCanBusFrame::DataFrame); QByteArray payload; payload[0] = 0xA4; payload[1] = 0x00; payload[2] = 0x90; payload[3] = 0x01; payload[4] = 0xFF; payload[5] = 0xFF; payload[6] = 0xFF; payload[7] = 0xFF; frameWritten = device->writeFrame(canID, payload);
-
Hi Pablo, I tried to write the array as you indicated (without round brackets), but it gives me compile error -> C: \ Users \ tre-ros \ Documents \ Rox6Aconsole \ main.cpp: 73: error: invalid types' < unresolved overloaded function type> [int] 'for array subscript
73 | payload.data [0] = 0xA4; -
@Rossano said in send message with Peak can bus:
Hi Pablo, I tried to write the array as you indicated
Just in case, I suggested to run the Qt CAN example...