Getting heading value

I want to get the current heading value from my vehicle in real time and receive it to an arduino so that i can run a custom script.is that possible

Yes, it is possible to get the vehicle heading via MAVLink messages on a serial port in real-time.

  1. Connect a FC serial port to an arduino serial port
  2. On the FC configure the serial port PROTOCOL to MAVLink2 and the desired baudrate
  3. On the arduino configure the serial port to the desired baudrate and teach arduino to talk MAVLink
  4. run a custom script on the arduino

or

  1. write a custom lua script that runs directly on the FC, no need for arduino hardware, no need for arduino software.