Code:
#include <mcp_can.h>
#include <mcp_can_dfs.h>
#include <SPI.h>
//https://github.com/coryjfowler/MCP_CAN_lib
//Constants
const int SHORT_PRESS_TIME = 500;
const int LONG_PRESS_TIME = 500;
const int BUTTON_PIN = 3;
//Variables
MCP_CAN CAN(10); //SPI_CS_PIN
byte dispSTART[8] = {0x10, 0x03, 0x20, 0x00, 0x00, 0x00, 0x50, 0x00}; //switch dash ON
// j N0 N1 N2 N3 N4 N5 N6 N7
byte dispSTOP[8] = {0x10, 0x04, 0x20, 0x00, 0x00, 0x00, 0x50, 0x00}; //switch dash OFF
bool dispisstarted=0;
//Variables about BUTTON state
int lastState = LOW; // the previous state from the input pin
int currentState; // the current reading from the input pin
unsigned long pressedTime = 0;
unsigned long releasedTime = 0;
int rpm=0;
// the setup function runs once when you press reset or power the board
void setup(){
while (CAN_OK != CAN.begin(MCP_STDEXT, CAN_500KBPS, MCP_16MHZ)){
delay(500);
}
CAN.setMode(MCP_NORMAL);
pinMode(BUTTON_PIN, INPUT_PULLUP);
// delay(5000); //just wait for a while...
// byte sndStat = CAN.sendMsgBuf(0x35d, 0, 8, dispOn); //returns TRUE, only if the can bus is connected!
Serial.begin(112500);
}
//Function to reset the Arduino
void(* resetFunc) (void)=0;
//void(* resetFunc) (void) = 0;
// the loop function runs over and over again forever
void loop(){
//int i=0,j=6; // i=byte value j=byte number
//byte testbyte[8] = {0x10, 0x03, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10};
// j N0 N1 N2 N3 N4 N5 N6 N7
int analoginput = analogRead(A0); // read the input on analog pin
int rpm = map(analoginput, 0, 1023, 18, 220); // Rescale to potentiometer's volta
byte rpmHEX = (int)rpm;
//bool button = digitalRead(BUTTON_PIN);
bool SHORT_button = LOW;
bool LONG_button = LOW;
// read the state of the switch/button:
currentState = digitalRead(BUTTON_PIN);
if(lastState == HIGH && currentState == LOW) // button is pressed
pressedTime = millis();
else if(lastState == LOW && currentState == HIGH) { // button is released
releasedTime = millis();
long pressDuration = releasedTime - pressedTime;
if( pressDuration < SHORT_PRESS_TIME ){
Serial.println("A short press is detected");
SHORT_button = HIGH;
}
if( pressDuration > LONG_PRESS_TIME ){
Serial.println("A LONG press is detected LONG LONG");
LONG_button = HIGH;
}
}
// save the the last state
lastState = currentState;
if (dispisstarted==0){
Serial.println("TURN ON");
byte sndStat0 = CAN.sendMsgBuf(0x35d, 0, 8, dispSTART);
dispisstarted = 1;
delay(100);
} // Wait 100ms and continue
Serial.println("TEST MODE ON");
byte dispTESTMODE[8] = {0x02, 0x10, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00};
byte sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispTESTMODE);
delay(10);
Serial.println("SMALL VFD FULL");
byte dispSMALLFULL[8] = {0x04, 0x30, 0x03, 0x20, 0x01, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispSMALLFULL);
delay(10);
Serial.println("BIG VFD FULL");
byte dispBIGFULL[8] = {0x04, 0x30, 0x06, 0x20, 0xFF, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL); // Fuel bar
delay(10);
byte dispBIGFULL1[8] = {0x04, 0x30, 0x07, 0x20, 0xFF, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL1); // Water temp bar
delay(10);
byte dispBIGFULL2[8] = {0x04, 0x30, 0x01, 0x20, 0x01, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL2); // Fog light front
delay(10);
byte dispBIGFULL3[8] = {0x04, 0x30, 0x01, 0x20, 0x07, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL3); // Fog light rear
delay(10);
byte dispBIGFULL4[8] = {0x04, 0x30, 0x01, 0x20, 0x06, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL4); // Head light - both green small and big
delay(10);
byte dispBIGFULL5[8] = {0x04, 0x30, 0x01, 0x20, 0x05, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL5); // Head light blue
delay(10);
byte dispBIGFULL6[8] = {0x04, 0x30, 0x01, 0x20, 0x00, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL6); // Service lamp
delay(10);
byte dispBIGFULL7[8] = {0x04, 0x30, 0x01, 0x20, 0x18, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL7); // Parking brake fault
delay(10);
byte dispBIGFULL8[8] = {0x04, 0x30, 0x01, 0x20, 0x12, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL8); // Unknown
delay(10);
byte dispBIGFULL9[8] = {0x04, 0x30, 0x01, 0x20, 0x11, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL9); // GAS
delay(10);
byte dispBIGFULL10[8] = {0x04, 0x30, 0x01, 0x20, 0x0A, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL10); // Cruis control(green arrow)
delay(10);
byte dispBIGFULL11[8] = {0x04, 0x30, 0x01, 0x20, 0x0B, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL11); // Speed limiter
delay(10);
byte dispBIGFULL12[8] = {0x04, 0x30, 0x01, 0x20, 0x04, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL12); // ABS fault
delay(10);
byte dispBIGFULL13[8] = {0x04, 0x30, 0x01, 0x20, 0x14, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL13); // Engine fault
delay(10);
byte dispBIGFULL14[8] = {0x04, 0x30, 0x01, 0x20, 0x17, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL14); // Unknown
delay(10);
byte dispBIGFULL15[8] = {0x04, 0x30, 0x03, 0x20, 0x00, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL15); // TEXT display + icons below
delay(10);
byte dispBIGFULL16[8] = {0x04, 0x30, 0x06, 0x11, 0xFF, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL16); // Turn off fuel bar
delay(10);
byte dispBIGFULL17[8] = {0x04, 0x30, 0x07, 0x11, 0xFF, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL17);
delay(10);
byte dispBIGFULL18[8] = {0x04, 0x30, 0x01, 0x11, 0x01, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL18);
delay(10);
byte dispBIGFULL19[8] = {0x04, 0x30, 0x01, 0x11, 0x07, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL19);
delay(10);
byte dispBIGFULL20[8] = {0x04, 0x30, 0x01, 0x11, 0x06, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL20);
delay(10);
byte dispBIGFULL21[8] = {0x04, 0x30, 0x01, 0x11, 0x05, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL21);
delay(10);
byte dispBIGFULL22[8] = {0x04, 0x30, 0x01, 0x11, 0x00, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL22);
delay(10);
byte dispBIGFULL23[8] = {0x04, 0x30, 0x01, 0x11, 0x18, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL23);
delay(10);
byte dispBIGFULL24[8] = {0x04, 0x30, 0x01, 0x11, 0x12, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL24);
delay(10);
byte dispBIGFULL25[8] = {0x04, 0x30, 0x01, 0x11, 0x11, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL25);
delay(10);
byte dispBIGFULL26[8] = {0x04, 0x30, 0x01, 0x11, 0x0A, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL26);
delay(10);
byte dispBIGFULL27[8] = {0x04, 0x30, 0x01, 0x11, 0x0B, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL27);
delay(10);
byte dispBIGFULL28[8] = {0x04, 0x30, 0x01, 0x11, 0x04, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL28);
delay(10);
byte dispBIGFULL30[8] = {0x04, 0x30, 0x01, 0x11, 0x14, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL30);
delay(10);
byte dispBIGFULL31[8] = {0x04, 0x30, 0x01, 0x11, 0x17, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL31);
delay(10);
byte dispBIGFULL32[8] = {0x04, 0x30, 0x03, 0x11, 0x00, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL32);
delay(10);
byte dispBIGFULL33[8] = {0x04, 0x30, 0x01, 0x20, 0x08, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL33); // ESP warn light
delay(10);
byte dispBIGFULL34[8] = {0x04, 0x30, 0x01, 0x20, 0x02, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL34); // Airbag-off warn light
delay(10);
byte dispBIGFULL35[8] = {0x04, 0x30, 0x01, 0x20, 0x15, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL35); // Airbag warn light
delay(10);
byte dispBIGFULL36[8] = {0x04, 0x30, 0x01, 0x20, 0x19, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL36); // Diesel heating warn light
delay(10);
byte dispBIGFULL37[8] = {0x04, 0x30, 0x01, 0x20, 0x0F, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL37); // Driver betl warn light
delay(10);
byte dispBIGFULL38[8] = {0x04, 0x30, 0x01, 0x20, 0x09, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL38); // Left blink light
delay(10);
byte dispBIGFULL39[8] = {0x04, 0x30, 0x01, 0x20, 0x0C, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL39); // Right blink light
delay(10);
byte dispBIGFULL40[8] = {0x04, 0x30, 0x01, 0x20, 0x0E, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL40); // Parking brake on light
delay(10);
byte dispBIGFULL41[8] = {0x04, 0x30, 0x01, 0x20, 0x03, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL41); // STOP light
delay(10);
byte dispBIGFULL42[8] = {0x04, 0x30, 0x01, 0x20, 0x13, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL42); // BATTERY light
delay(10);
byte dispBIGFULL43[8] = {0x04, 0x30, 0x01, 0x20, 0x10, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL43); // Oil red light
delay(10);
byte dispBIGFULL44[8] = {0x04, 0x30, 0x02, 0x20, 0x17, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL44); // Unknown
delay(10);
byte dispBIGFULL45[8] = {0x04, 0x30, 0x02, 0x20, 0x07, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL45); // Left front tire frame
delay(10);
byte dispBIGFULL46[8] = {0x04, 0x30, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL46); // Right front tire frame
delay(10);
byte dispBIGFULL47[8] = {0x04, 0x30, 0x02, 0x20, 0x16, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL47); // Left rear tire frame
delay(10);
byte dispBIGFULL48[8] = {0x04, 0x30, 0x02, 0x20, 0x11, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL48); // Right rear tire frame
delay(10);
byte dispBIGFULL49[8] = {0x04, 0x30, 0x02, 0x20, 0x0F, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL49); // Left front tire
delay(10);
byte dispBIGFULL50[8] = {0x04, 0x30, 0x02, 0x20, 0x08, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL50); // Right front tire
delay(10);
byte dispBIGFULL51[8] = {0x04, 0x30, 0x02, 0x20, 0x1E, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL51); // Left rear tire
delay(10);
byte dispBIGFULL52[8] = {0x04, 0x30, 0x02, 0x20, 0x19, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL52); // Right rear tire
delay(10);
byte dispBIGFULL53[8] = {0x04, 0x30, 0x02, 0x20, 0x06, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL53); // Left front door
delay(10);
byte dispBIGFULL54[8] = {0x04, 0x30, 0x02, 0x20, 0x01, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL54); // Right front door
delay(10);
byte dispBIGFULL55[8] = {0x04, 0x30, 0x02, 0x20, 0x0E, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL55); // Left rear door
delay(10);
byte dispBIGFULL56[8] = {0x04, 0x30, 0x02, 0x20, 0x09, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL56); // Right rear door
delay(10);
byte dispBIGFULL57[8] = {0x04, 0x30, 0x02, 0x20, 0x1F, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL57); // Back door
delay(10);
byte dispBIGFULL58[8] = {0x04, 0x30, 0x02, 0x20, 0x03, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL58); // P letter
delay(10);
byte dispBIGFULL59[8] = {0x04, 0x30, 0x02, 0x20, 0x1B, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL59); // R letter
delay(10);
byte dispBIGFULL60[8] = {0x04, 0x30, 0x02, 0x20, 0x12, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL60); // N letter
delay(10);
byte dispBIGFULL61[8] = {0x04, 0x30, 0x02, 0x20, 0x0A, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL61); // D letter
delay(10);
byte dispBIGFULL62[8] = {0x04, 0x30, 0x02, 0x20, 0x20, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL62); // Gear number
delay(10);
byte dispBIGFULL63[8] = {0x04, 0x30, 0x02, 0x20, 0x0B, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL63); // P letter frame
delay(10);
byte dispBIGFULL64[8] = {0x04, 0x30, 0x02, 0x20, 0x13, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL64); // R letter frame
delay(10);
byte dispBIGFULL65[8] = {0x04, 0x30, 0x02, 0x20, 0x1A, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL65); // N letter frame
delay(10);
byte dispBIGFULL66[8] = {0x04, 0x30, 0x02, 0x20, 0x02, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL66); // D letter frame
delay(10);
byte dispBIGFULL67[8] = {0x04, 0x30, 0x02, 0x20, 0x1D, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL67); // Gear number frame
delay(10);
byte dispBIGFULL68[8] = {0x04, 0x30, 0x05, 0x20, 0x46, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL68); // RPM bar almost full (gasoline maybe)
delay(10);
byte dispBIGFULL69[8] = {0x04, 0x30, 0x01, 0x20, 0x16, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL69); // RPM bar full (diesel maybe)
delay(10);
byte dispBIGFULL70[8] = {0x04, 0x30, 0x01, 0x11, 0x08, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL70);
delay(10);
byte dispBIGFULL71[8] = {0x04, 0x30, 0x01, 0x11, 0x02, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL71);
delay(10);
byte dispBIGFULL72[8] = {0x04, 0x30, 0x01, 0x11, 0x15, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL72);
delay(10);
byte dispBIGFULL73[8] = {0x04, 0x30, 0x01, 0x11, 0x19, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL73);
delay(10);
byte dispBIGFULL74[8] = {0x04, 0x30, 0x01, 0x11, 0x0F, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL74);
delay(10);
byte dispBIGFULL75[8] = {0x04, 0x30, 0x01, 0x11, 0x09, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL75);
delay(10);
byte dispBIGFULL76[8] = {0x04, 0x30, 0x01, 0x11, 0x0C, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL76);
delay(10);
byte dispBIGFULL77[8] = {0x04, 0x30, 0x01, 0x11, 0x0E, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL77);
delay(10);
byte dispBIGFULL78[8] = {0x04, 0x30, 0x01, 0x11, 0x03, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL78);
delay(10);
byte dispBIGFULL79[8] = {0x04, 0x30, 0x01, 0x11, 0x13, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL79);
delay(10);
byte dispBIGFULL80[8] = {0x04, 0x30, 0x01, 0x11, 0x10, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL80);
delay(10);
byte dispBIGFULL81[8] = {0x04, 0x30, 0x02, 0x11, 0x17, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL81);
delay(10);
byte dispBIGFULL82[8] = {0x04, 0x30, 0x02, 0x11, 0x07, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL82);
delay(10);
byte dispBIGFULL83[8] = {0x04, 0x30, 0x02, 0x11, 0x00, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL83);
delay(10);
byte dispBIGFULL84[8] = {0x04, 0x30, 0x02, 0x11, 0x16, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL84);
delay(10);
byte dispBIGFULL85[8] = {0x04, 0x30, 0x02, 0x11, 0x11, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL85);
delay(10);
byte dispBIGFULL86[8] = {0x04, 0x30, 0x02, 0x11, 0x0F, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL86);
delay(10);
byte dispBIGFULL87[8] = {0x04, 0x30, 0x02, 0x11, 0x08, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL87);
delay(10);
byte dispBIGFULL88[8] = {0x04, 0x30, 0x02, 0x11, 0x1E, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL88);
delay(10);
byte dispBIGFULL89[8] = {0x04, 0x30, 0x02, 0x11, 0x19, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL89);
delay(10);
byte dispBIGFULL90[8] = {0x04, 0x30, 0x02, 0x11, 0x06, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL90);
delay(10);
byte dispBIGFULL91[8] = {0x04, 0x30, 0x02, 0x11, 0x01, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL91);
delay(10);
byte dispBIGFULL92[8] = {0x04, 0x30, 0x02, 0x11, 0x0E, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL92);
delay(10);
byte dispBIGFULL93[8] = {0x04, 0x30, 0x02, 0x11, 0x09, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL93);
delay(10);
byte dispBIGFULL94[8] = {0x04, 0x30, 0x02, 0x11, 0x1F, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL94);
delay(10);
byte dispBIGFULL95[8] = {0x04, 0x30, 0x02, 0x11, 0x03, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL95);
delay(10);
byte dispBIGFULL96[8] = {0x04, 0x30, 0x02, 0x11, 0x1B, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL96);
delay(10);
byte dispBIGFULL97[8] = {0x04, 0x30, 0x02, 0x11, 0x12, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL97);
delay(10);
byte dispBIGFULL98[8] = {0x04, 0x30, 0x02, 0x11, 0x0A, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL98);
delay(10);
byte dispBIGFULL99[8] = {0x04, 0x30, 0x02, 0x11, 0x20, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL99);
delay(10);
byte dispBIGFULL100[8] = {0x04, 0x30, 0x02, 0x11, 0x0B, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL100);
delay(10);
byte dispBIGFULL101[8] = {0x04, 0x30, 0x02, 0x11, 0x13, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL101);
delay(10);
byte dispBIGFULL102[8] = {0x04, 0x30, 0x02, 0x11, 0x1A, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL102);
delay(10);
byte dispBIGFULL103[8] = {0x04, 0x30, 0x02, 0x11, 0x02, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL103);
delay(10);
byte dispBIGFULL104[8] = {0x04, 0x30, 0x02, 0x11, 0x1D, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL104);
delay(10);
byte dispBIGFULL105[8] = {0x04, 0x30, 0x05, 0x11, 0x46, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL105);
delay(10);
byte dispBIGFULL106[8] = {0x04, 0x30, 0x01, 0x11, 0x16, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL106);
delay(10);
byte dispBIGFULL107[8] = {0x04, 0x30, 0x04, 0x20, 0xBC, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL107); // 188km/h
delay(10);
byte dispBIGFULL109[8] = {0x04, 0x30, 0x04, 0x20, 0xC8, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL109); // 200km/h
delay(10);
byte dispBIGFULL108[8] = {0x04, 0x30, 0x04, 0x11, 0xBC, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL108);
delay(10);
byte dispBIGFULL110[8] = {0x04, 0x30, 0x04, 0x11, 0xC8, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL110);
delay(10);
byte dispBIGFULL111[8] = {0x04, 0x30, 0x03, 0x20, 0x01, 0x00, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL111); // SMALL VFD FULL
delay(10);
byte dispBIGFULL112[8] = {0x04, 0x30, 0x03, 0x11, 0x01, 0x00, 0x00, 0x00};
//sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL112);
delay(1000);
// sndStat0 = CAN.sendMsgBuf(0x743, 0, 8, dispBIGFULL);
// byte dispBIGFULL[8] = {};
/*
Serial.println("BIG VFD FULL");
byte dispBIGFULL[8] = {0x90, 0x02, 0xC0, 0xB7, 0x06, 0xD0, 0x00, 0x00};
byte sndStat0 = CAN.sendMsgBuf(0x5C5, 0, 8, dispBIGFULL);
delay(10);
/*Serial.println("BIG VFD FULL 00");
byte dispBIGFULL00[8] = {0x50, 0x02, 0xC0, 0xB7, 0x06, 0xD0, 0x00, 0x00};
sndStat0 = CAN.sendMsgBuf(0x5C5, 0, 8, dispBIGFULL00);
delay(10);
*/
/*
Serial.println("Status NORMAL");
byte dispNORMAL[8] = {0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x21, 0x70};
sndStat0 = CAN.sendMsgBuf(0x60d, 0, 8, dispNORMAL);
delay(10);
Serial.println("ENGINE UP AND RUNNING");
byte dispENGINE_ON[4] = {0x82, 0x00, 0xC0, 0x00};
sndStat0 = CAN.sendMsgBuf(0x625, 0, 4, dispENGINE_ON);
delay(10);
Serial.println("PARKING BRAKE ON");
byte dispPARK_ON[4] = {0x01, 0x80, 0xC4, 0x00};
sndStat0 = CAN.sendMsgBuf(0x75E, 0, 4, dispPARK_ON);
delay(10);
Serial.println("RPM");
byte dispRPM[8] = {rpmHEX, 0x88, 0x40, 0xAA, 0x36, 0xAA, 0xAA, 0xAA};
sndStat0 = CAN.sendMsgBuf(0x181, 0, 8, dispRPM);
delay(10);
Serial.println("WATER TEMPERATURE HIGH");
byte dispWATER_HIGH[7] = {0xAA, 0x66, 0x6A, 0x00, 0xFE, 0x52, 0x00};
sndStat0 = CAN.sendMsgBuf(0x551, 0, 7, dispWATER_HIGH);
delay(10);
if (SHORT_button == HIGH){
Serial.println("BUTTON PRESSED");
byte dispBUTTON[8] = {0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x21, 0x71};
byte sndStat0 = CAN.sendMsgBuf(0x60d, 0, 8, dispBUTTON);
SHORT_button = LOW;
}
*/
if (LONG_button == HIGH){
Serial.println("LONG BUTTON PRESSED - RESET");
resetFunc();
}
delay(100); //nothing to do here ;-)
/*//for (j=0; j<8; j++){
//Serial.println(j);
for (i=0; i<=255; i++){
testbyte[j] = byte(i);
for (int k=0; k<8; k++){
Serial.print(testbyte[k],HEX);
}
Serial.println(" ");
sndStat0 = CAN.sendMsgBuf(0x35d, 0, 8, testbyte);
//} */
}
Note: To turn pixels OFF use 0x11 messages. To turn pixels ON use 0x20 messages.
Bookmarks