Adafruit is open, safely ... and shipping all orders at this time! Read more!

Mag3110 Library not working with Microbit
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Mag3110 Library not working with Microbit

by Blueshark on Mon May 20, 2019 7:03 pm

Following this tutorial...

tutorial states using SparkFun MAG3110 library but its not compatible with the Microbit see code and error message's.

Code: Select all | TOGGLE FULL SIZE
/*  *********************************************
 *  SparkFun_MAG3110_Basic
 *  Triple Axis Magnetometer Breakout - MAG3110
 *  Hook Up Guide Example
 *  Utilizing Sparkfun's MAG3110 Library
 *  A basic sketch that reads x y and z readings
 *  from the MAG3110 sensor
 *  George B. on behalf of SparkFun Electronics
 *  Created: Sep 22, 2016
 *  Updated: n/a
 *  Development Environment Specifics:
 *  Arduino 1.6.7
 *  Hardware Specifications:
 *  SparkFun MAG3110
 *  Bi-directional Logic Level Converter
 *  Arduino Micro
 *  This code is beerware; if you see me (or any other SparkFun employee) at the
 *  local, and you've found our code helpful, please buy us a round!
 *  Distributed as-is; no warranty is given.
 *  *********************************************/

#include <SparkFun_MAG3110.h>

MAG3110 mag = MAG3110(); //Instantiate MAG3110

void setup() {

  mag.initialize(); //Initializes the mag sensor
  mag.start();      //Puts the sensor in active mode

void loop() {

  int x, y, z;
  //Only read data when it's ready
  if(mag.dataReady()) {
    //Read the data
    mag.readMag(&x, &y, &z);
    Serial.print("X: ");
    Serial.print(", Y: ");
    Serial.print(", Z: ");

Error mesages… is not in the form of an error where the compile stops rather it says after compiling
" In RED color.... Warning: library Sparkfun_MAG3110_Breakout_Board_Arduino_Library-master claims to run on (avr) architecture(s) and may be incompatible with your current board which runs on (nRF5) architecture(s). "

is there a fix to this?


Posts: 155
Joined: Thu Dec 21, 2017 7:19 pm

Please be positive and constructive with your questions and comments.