Engduino
3.1.0
A fun device for learning coding
|
Files | |
file | EngduinoMagnetometer.cpp |
file | EngduinoMagnetometer.h |
Classes | |
class | EngduinoMagnetometerClass |
Functions | |
EngduinoMagnetometerClass::EngduinoMagnetometerClass () | |
Constructor. More... | |
void | EngduinoMagnetometerClass::begin () |
begin function - must be called before using other functions More... | |
void | EngduinoMagnetometerClass::end () |
end function - switch off the magnetometer More... | |
void | EngduinoMagnetometerClass::xyz (float buf[3]) |
Read the xyz values from the magnetometer. More... | |
int8_t | EngduinoMagnetometerClass::temperature () |
Read the temperature value from the magnetometer. More... | |
Variables | |
EngduinoMagnetometerClass | EngduinoMagnetometer = EngduinoMagnetometerClass() |
EngduinoMagnetometerClass | EngduinoMagnetometer |
This is the driver code for Magnetometer on the Engduino In v2.1 this magnetometer is a freescale FXMS3110
void EngduinoMagnetometerClass::begin | ( | ) |
begin function - must be called before using other functions
This function enables the magnetometer. The magnetometer is an I2C device so we initialise the I2C communications, make contact with the magnetometer, and check that it's what we think it is.
We set the sampling rate to 10Hz, but where the values are from a heavily oversampled set of values
void EngduinoMagnetometerClass::end | ( | ) |
end function - switch off the magnetometer
Send the magnetometer to sleep
EngduinoMagnetometerClass::EngduinoMagnetometerClass | ( | ) |
Constructor.
C++ constructor for this class. Empty.
int8_t EngduinoMagnetometerClass::temperature | ( | ) |
Read the temperature value from the magnetometer.
Get the temperature as measured by the magnetometer - the temperature of the die. The register contains the die temperature in degrees C expressed as an 8-bit 2's complement number. The sensitivity of the temperature sensor is factory trimmed to 1°C/LSB. The temperature sensor offset is not factory trimmed and must be calibrated by the user software if higher absolute accuracy is required. Note: The register allows for temperature measurements from -128°C to 127°C but the output range is limited to -40°C to 125°C. The temperature data is updated on every measurement cycle.
void EngduinoMagnetometerClass::xyz | ( | float | buf[3] | ) |
Read the xyz values from the magnetometer.
buf | A buffer of floats to put the magnetometer values into |
Get the instantaneous magnetometer values for the xyz axes. Convert the 16 bit digital value to a float value.