acan-esp32
acan-esp32 copied to clipboard
Issues with format of the data in CMessage class
Hi, I am a bit new to this library and CAN in general. I have an ADXL357 accelerometer that give me 3 axis, each containing 8 Bytes of data, becausse the values are on type double. Now just for a small test I want to sent out each iteration one axis, in my case z. But it seems like the append() is setting the ok variable to false, not sending out any kind of data. On startup there is weird behaviour, because it tells me that the ok Variable is true, but the number of SentFrameCounts is not progressing more than just to the value of one.
So I am asking myself what the problem might be?
Snipplet out of the main File. This whole snipplet is written within a for-loop function iterating through the different sensors.
CANMessage frame;
if(gSentFrameCountESP32 < MESSAGE_COUNT)
{
frame.id = 0x001F;
frame.len = 8;
frame.data_s64 = z;
frame.rtr = false;
frame.ext = false;
const bool ok = ACAN_ESP32::can.tryToSend(frame);
Serial.print("The Value of the ok variable is: ");
Serial.println(ok);
if(ok)
{
gSentFrameCountESP32 =+ 1;
}
}
while(ACAN_ESP32::can.receive(frame))
{
gReceivedFrameCountESP32 =+ 1;
}
Serial.print("Numbers of packets sent: ");
Serial.print(gSentFrameCountESP32);
}