Hate to admit I need some help

Trying to figure out how to send Arduino Mega pins 22 thru 53 to Realdash. I understand the xml but can’t grasp the ino file. I tried to modify the example like this:

// Arduino digital pins
unsigned int digitalPins1 = 0;
unsigned int digitalPins2 = 0;

void setup()
{
  // init serial
  Serial.begin(115200);
  delay(10);
  
}
void loop()
{
  ReadDigitalStatuses();
  SendCANFramesToSerial();

  }
void ReadDigitalStatuses()
{
  // read status of digital pins (22-53)
  digitalPins1 = 0;
  digitalPins2 = 0;

  int bitposition = 0;
  for (int i=22; i<37; i++)
  {
    if (digitalRead(i) == HIGH) digitalPins1 |= (1 << bitposition);
    bitposition++;
  }

  for (int i=38; i<53; i++)
  {
    if (digitalRead(i) == HIGH) digitalPins2 |= (1 << bitposition);
    bitposition++;
  }
 }
void SendCANFramesToSerial()
{
  byte buf[8];

   // build 2nd CAN frame,
  memcpy(buf, &digitalPins1, 2);


  // write 2nd CAN frame to serial
  SendCANFrameToSerial(3201, buf);

  // build 3rd CAN frame
  memcpy(buf, &digitalPins2, 2);
}

Am I in the right direction? or am I going about this all wrong?

This is resolved.

How did you do to read friend?

Not pretty but got the job done for me:

// Arduino digital and analog pins
uint64_t digitalPins = 0;//

const uint8_t pins[] = { 22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47 };
const uint8_t nPins = sizeof pins / sizeof pins[0];

void setup()
{
  // init serial
  Serial.begin(115200);
  delay(10);
  analogReference (DEFAULT);
  pinMode(A1, INPUT_PULLUP);
  pinMode(A2, INPUT_PULLUP);
  pinMode(A3, INPUT_PULLUP);
  pinMode(A4, INPUT_PULLUP);
  pinMode(A5, INPUT_PULLUP);
  pinMode(A6, INPUT_PULLUP);
  pinMode(A7, INPUT_PULLUP); 

}

void loop()
{
  
  
  ReadDigitalStatuses();
  ReadAnalogStatuses();
  SendCANFramesToSerial();

} 

void ReadDigitalStatuses()
{
  // read status of digital pins (22-53)
  digitalPins = 0;
  

  int bitposition = 0;
  for (int i=0; i<nPins; i++)
  {
    if (digitalRead(pins[i]) == HIGH) digitalPins |= (1ULL << bitposition);
    bitposition++;
  }
  
 }


void ReadAnalogStatuses()
{

}



void SendCANFramesToSerial()
{
  byte buf[8];
 int TODf3 = analogRead(1);
 int TODf2 = analogRead(2);
 int TODf1 = analogRead(3);
 int TODauto = analogRead(4);
 int TODcheck = analogRead(5);
 int TODrr = analogRead(6);
 int TODlr = analogRead(7);
 int fuel = analogRead(8);
    fuel = map(fuel, 1023, 0, 0, 1023);
 int spare = analogRead(9);
 int LeftLane = analogRead(10);
 int RightLane = analogRead(11);
 int DashDimmer = analogRead(12);
  
   // build 3200 CAN frame
  memcpy(buf, &TODcheck, 2);
  memcpy(buf + 2, &TODrr, 2);
  memcpy(buf + 4, &TODlr, 2);
  memcpy(buf + 6, &fuel, 2);
  // write 3200 CAN frame to serial
  SendCANFrameToSerial(3200, buf);

  // build 3201 CAN frame
  memcpy(buf, &digitalPins, sizeof(digitalPins));//memcpy(buf, &digitalPins, 2);


  // write 3201 CAN frame to serial
  SendCANFrameToSerial(3201, buf);

  // build 3rd CAN frame
  memcpy(buf, &TODf3, 2);
  memcpy(buf + 2, &TODf2, 2);
  memcpy(buf + 4, &TODf1, 2);
  memcpy(buf + 6, &TODauto, 2);
  

  // write 3rd CAN frame to serial
  SendCANFrameToSerial(3202, buf);

   // build 4th CAN frame
  memcpy(buf, &spare, 2);
  memcpy(buf + 2, &LeftLane, 2);
  memcpy(buf + 4, &RightLane, 2);
  memcpy(buf + 6, &DashDimmer, 2);
  

  // write 4th CAN frame to serial
  SendCANFrameToSerial(3203, buf);
}



void SendCANFrameToSerial(unsigned long canFrameId, const byte* frameData)
{
  // the 4 byte identifier at the beginning of each CAN frame
  // this is required for RealDash to 'catch-up' on ongoing stream of CAN frames
  const byte serialBlockTag[4] = { 0x44, 0x33, 0x22, 0x11 };
  Serial.write(serialBlockTag, 4);

  // the CAN frame id number (as 32bit little endian value)
  Serial.write((const byte*)&canFrameId, 4);

  // CAN frame payload
  Serial.write(frameData, 8);
}

Thank you very much friend, I will work on this code.

How is your project?