Forum Rule: Always post complete source code & details to reproduce any issue!
-
sending data over CAN from teensy
I am using the improved flex can library and I have it reading Messages fine using
Code:
FRWJCAN =msg.buf[2]*256 +msg.buf[3];
if (FRWJCAN> 32768)
{
FRP = (FRWJCAN- 65536)*1.00;
}
else
{
FRP = FRWJCAN*1.00;
}
to read a specific can message and wrapping it if it goes negative.
What i want to do is send internal temp ( of the teensy3.6 on any CAN id)
any ideas of how i can do that? I am using SN65HVD230D transceivers.
Thank you!
-
You mean like the sending struct?
Code:
CAN_message_t msg;
msg.id = 0x123;
msg.flags.extended = 0;
msg.len = 8;
msg.buf[0] = myTemperature;
Can0.write(msg);
As for keeping a value positive, you can use abs()
Code:
abs(-10.6);
abs(18);
Output:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules