Hi there, I'm newbie of Arduino, I want using MAG 3110 sensor to implement a gyroscope, I'm not sure it could or not, anyway I need it.
Following is the example code of it (have been modified):
/*
read_xyz.ino - Example prints raw x,y,z values on current magnetic field
Copyright (C) 2012 Lara Booth for NanoSatisfi
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "NanoSatisfi_MAG3110.h"
#include <Wire.h>//for I2C
NanoSatisfi_MAG3110 mag;
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output (fast)
mag.configMag(); // turn the MAG3110 on
}
void loop()
{
//print the raw values of x,y,z
Serial.print("X:");
Serial.print( mag.readx());
Serial.print("\t");
Serial.print("Y:");
Serial.print( mag.ready());
Serial.print("\t");
Serial.print("Z:");
Serial.println( mag.readz());
delay(1000);//wait a second
}
There is a problem makes me confused:
What is the value of x, y, z? the tri-axis accumulate?
grateful for your help!
Yours sincerely,
Ray