A compass is a useful instrument to find a bearing and to follow a direction. This sketch uses an arduino 2560 and a HMC5883L electronic compass from Honeywell. It can be used in a robot, plane, car or boat to follow a heading.

The project is very simple. It has only a compass module with a I2C serial link and an Arduino 2560 R3. The heading result can be visualized on a PC with the aid of  Processing 3.0 code. The  file with the code is on this page.