HMC5883L 3-assig digitale kompas module GY-273

(1 klant review)

€1,00

Nieuw model: HMC5983

Niet op voorraad

Voorraad notificatie email ontvangen?

SKU: HE01611-600 Categorieën: , Tags: , , , Verzenden:

Beschrijving

!! Niet meer leverbaar !! Nieuw model: HMC5983

HMC5883L 3-assige digitale kompas chip op een breakout board. Aan te sluiten via de I2C interface.

HMC5883L specificaties:
– Op basis van de: HMC5883L chip.
– Werkt op: 3-5v.
– Interface: I2c.
– Meetbereik: ± 1.3-8 Gauss.

Arduino code voorbeeld:

Library

#include <Wire.h>
#include <HMC5883L.h>

HMC5883L compass;


void setup(){
 Serial.begin(9600);
 Wire.begin();
 
 compass = HMC5883L(); //new instance of HMC5883L library
 setupHMC5883L(); //setup the HMC5883L
}

// Our main program loop.
void loop(){
 
 float heading = getHeading();
 Serial.println(heading);
 delay(100); //only here to slow down the serial print

}

void setupHMC5883L(){
 //Setup the HMC5883L, and check for errors
 int error; 
 error = compass.SetScale(1.3); //Set the scale of the compass.
 if(error != 0) Serial.println(compass.GetErrorText(error)); //check if there is an error, and print if so

 error = compass.SetMeasurementMode(Measurement_Continuous); // Set the measurement mode to Continuous
 if(error != 0) Serial.println(compass.GetErrorText(error)); //check if there is an error, and print if so
}

float getHeading(){
 //Get the reading from the HMC5883L and calculate the heading
 MagnetometerScaled scaled = compass.ReadScaledAxis(); //scaled values from compass.
 float heading = atan2(scaled.YAxis, scaled.XAxis);

 // Correct for when signs are reversed.
 if(heading < 0) heading += 2*PI;
 if(heading > 2*PI) heading -= 2*PI;

 return heading * RAD_TO_DEG; //radians to degrees
}

1 beoordeling voor HMC5883L 3-assig digitale kompas module GY-273

  1. Electronics4Fun (geverifieerde eigenaar) –

    Goede en nauwkeurige compassensor.

Enkel ingelogde klanten die dit product gekocht hebben, mogen een beoordeling schrijven.

Verzending binnen Nederland

Dit product word bezorgd via PostNL briefpost in een bubbel envelop.
- € 3.45 verzendkosten voor orders onder de € 25,-.
- € 2.95 verzendkosten voor orders tussen € 25 - 45,-.
- Orders boven de € 45,- worden gratis verstuurd per PostNL briefpost.

  • Op werkdagen voor 16:30 uur besteld, zelfde dag verzonden!
    Klik hier voor de kosten buiten Nederland.
  • Product vraag?

      Uw naam (verplicht)

      Uw email (verplicht)

      Uw vraag