Specifications
- QMC5883L magnetometer
- I2C bus, address 0x0D
- Heading 0–359°, 0 = north
- You can stack another module on top of it
- Power 3.3 V
- Current ≈ 0.1 mA (QMC5883L figure)
- The address is fixed, so two compasses cannot share the bus
- Uses: navigation and orientation, robots and drones
Pins
| Pin | Function |
|---|---|
| IO14 | I2C SDA |
| IO15 | I2C SCL |
Wiring diagram
Example code
Try the example Compass with an arrow right in your browser in Eduingo AI Lab. The compass measures which way the kit is facing (0° = north, 90° = east, 180° = south, 270° = west). The display shows the degrees, the cardinal direction and an arrow pointing north. The program compares the heading with the borders between the directions one by one. Try adding north-east and the other directions in between.