Package jpigpio.sensors
Class GY_271
java.lang.Object
jpigpio.sensors.GY_271
public class GY_271
extends java.lang.Object
The GY-271 is a module that provides a multi axis magnetic field measurement that is typically used to provide a compass. It is based on the Honeywell HMC5883L IC. The module
uses I2C for communications.
This Java class provides a wrapper to its low level functions for use with Pigpio.
author Neil Kolban
date 2015-05-06
-
Field Summary
Fields Modifier and Type Field Description static int
GAIN_0230
static int
GAIN_0330
static int
GAIN_0390
static int
GAIN_0440
static int
GAIN_0660
static int
GAIN_0820
static int
GAIN_1090
static int
GAIN_1370
static int
MODE_CONTINUOUS
static int
MODE_IDLE
static int
MODE_SINGLE
static int
OUTPUT_RATE_0_75
static int
OUTPUT_RATE_1_5
static int
OUTPUT_RATE_15
static int
OUTPUT_RATE_3
static int
OUTPUT_RATE_30
static int
OUTPUT_RATE_7_5
static int
OUTPUT_RATE_75
static int
SAMPLES_1
static int
SAMPLES_2
static int
SAMPLES_4
static int
SAMPLES_8
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
close()
Close our usage of the I2C bus.java.lang.String
getId()
Get the device id.byte
getStatus()
int
getX()
int
getY()
int
getZ()
void
initialize()
Initialize the GY-271void
readValue()
void
setGain(int value)
void
setMode(int value)
void
setOutputRate(int value)
void
setSamples(int value)
java.lang.String
toString()
-
Field Details
-
SAMPLES_1
public static final int SAMPLES_1- See Also:
- Constant Field Values
-
SAMPLES_2
public static final int SAMPLES_2- See Also:
- Constant Field Values
-
SAMPLES_4
public static final int SAMPLES_4- See Also:
- Constant Field Values
-
SAMPLES_8
public static final int SAMPLES_8- See Also:
- Constant Field Values
-
OUTPUT_RATE_0_75
public static final int OUTPUT_RATE_0_75- See Also:
- Constant Field Values
-
OUTPUT_RATE_1_5
public static final int OUTPUT_RATE_1_5- See Also:
- Constant Field Values
-
OUTPUT_RATE_3
public static final int OUTPUT_RATE_3- See Also:
- Constant Field Values
-
OUTPUT_RATE_7_5
public static final int OUTPUT_RATE_7_5- See Also:
- Constant Field Values
-
OUTPUT_RATE_15
public static final int OUTPUT_RATE_15- See Also:
- Constant Field Values
-
OUTPUT_RATE_30
public static final int OUTPUT_RATE_30- See Also:
- Constant Field Values
-
OUTPUT_RATE_75
public static final int OUTPUT_RATE_75- See Also:
- Constant Field Values
-
GAIN_1370
public static final int GAIN_1370- See Also:
- Constant Field Values
-
GAIN_1090
public static final int GAIN_1090- See Also:
- Constant Field Values
-
GAIN_0820
public static final int GAIN_0820- See Also:
- Constant Field Values
-
GAIN_0660
public static final int GAIN_0660- See Also:
- Constant Field Values
-
GAIN_0440
public static final int GAIN_0440- See Also:
- Constant Field Values
-
GAIN_0390
public static final int GAIN_0390- See Also:
- Constant Field Values
-
GAIN_0330
public static final int GAIN_0330- See Also:
- Constant Field Values
-
GAIN_0230
public static final int GAIN_0230- See Also:
- Constant Field Values
-
MODE_CONTINUOUS
public static final int MODE_CONTINUOUS- See Also:
- Constant Field Values
-
MODE_SINGLE
public static final int MODE_SINGLE- See Also:
- Constant Field Values
-
MODE_IDLE
public static final int MODE_IDLE- See Also:
- Constant Field Values
-
-
Constructor Details
-
GY_271
Construct the object for this class.- Parameters:
pigpio
- The reference to the Pigpio controller
-
-
Method Details
-
initialize
Initialize the GY-271- Throws:
PigpioException
- on pigpiod error
-
close
Close our usage of the I2C bus.- Throws:
PigpioException
- on pigpiod error
-
readValue
- Throws:
PigpioException
-
getX
public int getX() -
getY
public int getY() -
getZ
public int getZ() -
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getId
Get the device id. A normal device will have an id of "H43".- Returns:
- The string representation of the device
- Throws:
PigpioException
- on pigpiod error
-
setGain
- Throws:
PigpioException
-
setMode
- Throws:
PigpioException
-
setSamples
- Throws:
PigpioException
-
setOutputRate
- Throws:
PigpioException
-
getStatus
- Throws:
PigpioException
-