Hi,
First of all i'm new to the forum and not sure if i'm in the right category so sorry for my mistakes.
I am trying to communicate an ESP32 with a Teensy 4.1 using CANBUS (FlexCAN_T4 library on Teensy and CAN library on ESP32). ESP32 reads some DS18B20 and sends it to Teensy over CANBUS for Teensy to store it and use it to display on a screen and set off an alarm when its too high etc.
I can send and receive data without a problem but the data is decimal.
in C++ when you write 'w' with the single quotes, you are using a character literal and that is represented in memory with the ASCII code of the letter β here for 'w' it's 119 in decimal, so that's what you get on the other end.
you would receive 4 bytes on the other side holding the values (in decimal) 10, 20, 30 and 40.
sending your sensor data could be done in binary, just sending the bytes payload over, or as text representation (a string). It's a design choice.
in binary that would look like this
int16_t temperature = 326; // whatever the raw reading of the sensor is
CAN.beginExtendedPacket(0xabcdef);
CAN.write(& temperature, sizeof temperature); // send the bytes
CAN.endPacket();
for this to work easily you would need to ensure the receiving platform uses the same endianness
regarding the question on how to "store and process the sensor readings" , it's basically the same as handling Serial communication β I would suggest to study Serial Input Basics to handle this