Magnetometer Shield acts as Arduino Shield via 1Sheeld

Buy 1Sheeld
Arduino metal detector shield via smartphone - 1Sheeld

Use the magnetometer sensor on your smartphone as a compass to control the direction of any moving robot, or
even use it as a metal detector to prototype a security gate! Learn more from the example page.

This shield is one of the sensor shields. Sensor shields allows you to tap into your smartphone’s sensors and use in prototyping with Arduino, you can get information from the surrounding environment and use
it to trigger a certain action. Learn more from the sensor shields tutorial.

Magnetic sensors measures the ambient geomagnetic field for all  3 Axis(x,y & z). Magnetometer sensor Library allows Arduino to get measured magnetic vectors from the smartphone’s magnetometer.

Adding #define CUSTOM_SETTINGS along with #define INCLUDE_MAGNETOMETER_SENSOR_SHIELD is a key that will let you unlock the Magnetometer sensor shield only amongst all shields and prevent 1Sheeld library from eating your memory specially for UNO board.

Gets magnetic vector on the X-axis of your smartphone.

Note: every smartphone has it’s own directed axis so don’t count them on the examples.

SYNTAX

MagnetometerSensor.getX( );

RETURNS

float magnetic value on the X-axis.

PARAMETERS

None.

USAGE

float xValue = MagnetometerSensor.getX();

Gets magnetic vector on the Y-axis of your smartphone.

Note: every smartphone has it’s own directed axis so don’t count them on the examples.

SYNTAX

MagnetometerSensor.getY( );

RETURNS

float magnetic value on the Y-axis.

PARAMETERS

None.

USAGE

float yValue = MagnetometerSensor.getY();

Gets magnetic vector on the Z-axis of your smartphone.

Note: every smartphone has it’s own directed axis so don’t count them on the examples.

SYNTAX

MagnetometerSensor.getZ( );

RETURNS

float magnetic value on the Z-axis.

PARAMETERS

None.

USAGE

float zValue = MagnetometerSensor.getZ();

Sets a certain individual function written by the user in the sketch to be called and runs its functionality once a new value is sensed and sent by the application to the Arduino.

SYNTAX

MagnetometerSensor.setOnValueChange(&userFunctionName);

RETURNS

None.

PARAMETERS

&userFunctionName: takes the physical address of the userFunction in the memory and jump to it once called to execute it’s functionality.

USAGE

MagnetometerSensor.setOnValueChange(&myFunction);
/* myFunction exists under the loop function. */
/* This function will be invoked each time a new value comes to arduino from the  
   smartphones magnetic sensor. */
void myFunction (float xAxisValue, float yAxisValue, float zAxisValue)
{
    /* Print x-y-z axis values on the Terminal Shield. */
    Terminal.println(xAxisValue);
    Terminal.println(yAxisValue);
    Terminal.println(zAxisValue);
}