Code:
#include <IFCT.h>
#define qBlink() (digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN) ))
#include <InternalTemperature.h>
InternalTemperature temperature;
// variable declaration ************************
int TempCount = 0;
void setup() {
Serial.begin(9600);
//**** Setting pin outputs
delay(10000);
//******* CAN SETUP *****************
pinMode(28, OUTPUT); // for the transceiver enable pin
digitalWrite(28, LOW); // Low for HIGH speed
Can0.setTX(ALT); // for pin 29
Can0.setRX(ALT); // for pin 30
Can0.setBaudRate(1000000); // matches PI System
Can0.enableFIFO(); // First in first out CAN style
}
void loop()
{
CAN_message_t msg;
if ( Can0.read(msg))
{
digitalWrite(LED_BUILTIN, HIGH);
if (msg.id == 613) // 265 HEX
{
FCAN = msg.buf[0] * 256 + msg.buf[1];
if (FCAN > 32768)
{
F = (FCAN - 65536) / 100.00;
}
else
{
F = FCAN / 100.00;
}
}
// Displays internal temp of Teensy
if (TempCount >= 1000)
{
Serial.print("Temperature: ");
Serial.print(temperature.readTemperatureC(), 1);
Serial.println("°C");
CAN_message_t msg;
msg.id = 0x617;
msg.flags.extended = 0;
msg.len = 8;
msg.buf[0] = temperature.readTemperatureC();
Can0.write(msg);
TempCount = 0;
}
TempCount++;
}
else
{
digitalWrite(LED_BUILTIN, LOW);
}
So I just relized in my If can read is my can send, do I need to do that in my else outside of that loop? or can i do it how I have it?
@tonton81