I have this code running continuously in my Tesla powered Mustang and it works great controlling my DC to DC converter and electric power steering. Now I want to use this code to run a couple things in Realdash and for reason I cannot figure out how to make the Can1 start when feeding 3.3 volts into pin 14 to turn it on instead of it running all the time. I've watch hours of tutorials and everything I've tried does not work. I left all my trials out of it because of it being a mess. I'm using a Teensy 4.0. I want to turn it on with Pin 14 and shut it off with pin 15.
#include <FlexCAN_T4.h>
int parkPin=14;
int revPin=15;
int dt=500;
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> myCan1;
void setup() {
// put your setup code here, to run once:
delay(dt);
pinMode(parkPin, INPUT);
pinMode(revPin, INPUT)
myCan1.begin();
myCan1.setBaudRate(500*1000);
}
void loop() {
// put your main code here, to run repeatedly:
CAN_message_t frame;
frame.id = 0x201;
frame.len = 8;
frame.buf[0] = 0x0C;
frame.buf[1] = 0x80;
frame.buf[2] = 0x00;
frame.buf[3] = 0x00;
frame.buf[4] = 0x27;
frame.buf[5] = 0x10;
frame.buf[6] = 0x14;
frame.buf[7] = 0x00;
myCan1.write(frame);
if ( myCan1.read(frame) )
{
Serial.print("CAN1 ");
Serial.print(" ID: 0x"); Serial.print(frame.id, HEX );
}
digitalWrite(parkPin, !digitalRead(parkPin));
delay (dt);
}
Hi Railroader, Well I guess you did not understand my question. I do have schematics and have build Mustang Tesla conversions for years but that's not my issue. Thank you for taking the time though.