NMEA HDG datagram format
The NMEA HDG datagram provides heading from a magnetic sensor. If this reading is corrected for deviation, it produces the magnetic heading. If it is offset by variation, it provides the true heading.
Format
$--HDG,x.x,z.z,a,r.r,a*hh<CR><LF>
Description
1 $—: Talker identifier
2 HDG: Datagram identifier
3 x.x: (Degrees  (Magnetic))
4 z.z,a: Deviation (Degrees  (Magnetic)), East/West
•  W = West
•  E = East
5 r.r,a Variation (Degrees  (Magnetic)), East/West
•  W = West
•  E = East
6 *hh: Checksum