Connecting Arduino To Pixhawk

Hello, I’m an absolute beginner trying to connect Arduino To Pixhawk.

I started off by writing a simple Arduino Sketch to check for heartbeats from Pixhawk. The pixhawk is connected to my Arduino Nano, and the Nano is connected to my PC. I’m receiving bytes from the Pixhawk, but i’m not able to parse the message. Attached below are my code and the mavlink library I’m using. I guess it could be because the mavlink header files might be outdated, but if I try to download the mavlink files from the github, Arduino doesnt detect them. Only this particular folder works.
mavlink.zip (300.9 KB)

Code:
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <mavlink.h>

#define RX_PIN 3
#define TX_PIN 2
#define HEARTBEAT_TIMEOUT_MS 30000 // 30 seconds

SoftwareSerial SerialMAV(RX_PIN, TX_PIN);

uint32_t last_heartbeat_time = 0; //define a 32 bit variable

void setup() {
Serial.begin(57600);
SerialMAV.begin(57600);
Serial.println(SerialMAV.isListening());
}

void _MavLink_receive() {
mavlink_message_t msg; //This line declares a variable msg of the type mavlink_message_t. This is a structure defined by the MAVLink library,
//which is used to store information about a decoded MAVLink message.
//It contains fields such as the message ID, payload data, and other message-related information.
mavlink_status_t status; //This line declares a variable status of the type mavlink_status_t. This is another structure defined by the MAVLink library,
//which is used to store the status of the MAVLink parser while processing incoming data. It contains fields such as the current parser state,
//the number of bytes in the message payload, and the message checksum, among others.

bool parsed = false;

while (SerialMAV.available()) {
uint8_t c = SerialMAV.read();
Serial.println(String("Byte: ") + c);
if (mavlink_parse_char(MAVLINK_COMM_0, c, &msg, &status)) {
Serial.print(“DEBUG msgid:”);Serial.println(msg.msgid);
Serial.println(“DEBUG protocol: MAVLink 1”);
parsed = true;
}
else if (mavlink_parse_char(MAVLINK_COMM_1, c, &msg, &status)) {
Serial.print("DEBUG msgid: "); Serial.println(msg.msgid);
Serial.println(“DEBUG protocol: MAVLink 2”);
parsed = true;
}

if (parsed) {  
switch(msg.msgid) {
    case MAVLINK_MSG_ID_HEARTBEAT:
      last_heartbeat_time = millis();
      Serial.println("Heartbeat received.");
      break;
  // Add more cases to handle other message IDs, if necessary
  }
} else {
  Serial.println("DEBUG: mavlink_parse_char failed.");
}

}

// Check if heartbeat timeout has occurred
// if (millis() - last_heartbeat_time > HEARTBEAT_TIMEOUT_MS) {
// Serial.println(“ERROR: Heartbeat timeout.”);
// }
}

void loop() {
_MavLink_receive();
}