I made a compass using
3-coloured LCD sheild
4- 4 male/female wires .
Please follow the steps for connection description and the full code .
Step 1: The Connection
1-Put the colour lcd sheild on the top of the arduino mega (it will perfectly fit).
2-Connect the four wires using female terminal to the LSM303 pins as in attached photos and the other male terminal to the arduino mega to the corresponding pins ( 5v , GND ,SDA,SCL )
Step 2: The Code
I used the two attached libraries(not my own libraries) in my code
1- color lcd shield library which will be imported easily.
2-lsm303 library which I needed to extract firstly before importing and import the folder called "lsm303" only .
and attached my code called "compass'" .