Giter Site home page Giter Site logo

arduino-hmc5883l's People

Contributors

albfan avatar ensigncrasher avatar jarzebski avatar robsonos avatar xxzl0130 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-hmc5883l's Issues

m_pi

Hello dear
what is M_PI ?and the value that M_PI can get?
tnx <3

No data printed in serial monitor while using esp32

My first question is does this library work with ESP-32? I am using the calibrate.ino sketch and it compiles without any errors. But when I look at my serial monitor, nothing prints. I disconnected the pins to my sensor, and it showed - "No I2c device found" as it should. ( There's only a delay function in the code, I added the serial. print thing) But when I again connect those pins, I get nothing. Can anyone please help me? I really need this library to work with a ESP-32., else I will run into a wall doing my project, and I already invested much.

Edit: I used HMC5883L_compass.ino and the serial monitor is stuck at 1����<
ڔ!�a��@�Initialize HMC5883L

Note: my HMC5883L has I2C address of 0x0E, and works ok with the adafruit library(has calibration issues tho)

Library for ADXL345

Hi,
Thanks for sharing your work with us.

I am trying this with ADXL345, but I couldn't find the ADXL345 library you have used. Can you please share the link to it...

Thanks,
BK Krunal

App hangs after a while

Hi! I'm using your example but it hangs on Vector raw = compass.readRaw(); after 2-5 minutes if I'm using 1m UTP cable. If direct connection - everything ok. What can you recommend?

UPD: the reason for that is infinite loop in readRegister16 depending on !Wire.available()
So some fail safe could be added. I patched it like

    if(!Wire.available()) {
      while (!begin())
      {
        Serial.println("Could not find a valid HMC5883L sensor, check wiring!");
        delay(100);
      }
      return 0;
    }

But the wire lib doesn't provide fail safe in it's Wire.endTransmission(); so if the power is lost for a second it won't recover too. So maybe should use another I2C lib with timeout support.

'HMC5883L' does not name a type

I get this error

with this code

`#include <Adafruit_HMC5883_U.h>
#if defined(ESP8266)
#include <ESP8266WiFi.h> // Include the Wi-Fi library
#else
#include <WiFi.h>
#endif
#include <WiFiUdp.h> // UDP library

#include <OSCMessage.h> // OSC library
#include <Wire.h>

HMC5883L compass;

const char* ssid = ""; // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = ""; // The password of the Wi-Fi network

WiFiUDP Udp; // A UDP instance to let us send and receive packets over UDP
const IPAddress outIp(192,168,0,234); // remote IP of your computer
const unsigned int outPort = 4559; // remote port to receive OSC
const unsigned int localPort = 8888; // local port to listen for OSC packets (actually not used for sending)

void setup() {
Serial.begin(115200); // Start the Serial communication to send messages to the computer
delay(10);
Serial.println('\n');

WiFi.begin(ssid, password); // Connect to the network
Serial.print("Connecting to ");
Serial.print(ssid); Serial.println(" ...");

int i = 0;
while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
delay(1000);
Serial.print(++i); Serial.print(' ');
}

Serial.println('\n');
Serial.println("Connection established!");
Serial.print("IP address:\t");
Serial.println(WiFi.localIP()); // Send the IP address of the ESP8266 to the computer

Serial.println("Starting UDP");
Udp.begin(localPort);
Serial.print("Local port: ");
#ifdef ESP32
Serial.println(localPort);
#else
Serial.println(Udp.localPort());
#endif

// Initialize HMC5883L
Serial.println("Initialize HMC5883L");
while (!compass.begin())
{
Serial.println("Could not find a valid HMC5883L sensor, check wiring!");
delay(500);
}
compass.setRange(HMC5883L_RANGE_1_3GA);
compass.setMeasurementMode(HMC5883L_CONTINOUS);
compass.setDataRate(HMC5883L_DATARATE_15HZ);
compass.setSamples(HMC5883L_SAMPLES_1);

checkSettings();

}

void checkSettings()
{
Serial.print("Selected range: ");

switch (compass.getRange())
{
case HMC5883L_RANGE_0_88GA: Serial.println("0.88 Ga"); break;
case HMC5883L_RANGE_1_3GA: Serial.println("1.3 Ga"); break;
case HMC5883L_RANGE_1_9GA: Serial.println("1.9 Ga"); break;
case HMC5883L_RANGE_2_5GA: Serial.println("2.5 Ga"); break;
case HMC5883L_RANGE_4GA: Serial.println("4 Ga"); break;
case HMC5883L_RANGE_4_7GA: Serial.println("4.7 Ga"); break;
case HMC5883L_RANGE_5_6GA: Serial.println("5.6 Ga"); break;
case HMC5883L_RANGE_8_1GA: Serial.println("8.1 Ga"); break;
default: Serial.println("Bad range!");
}

Serial.print("Selected Measurement Mode: ");
switch (compass.getMeasurementMode())
{
case HMC5883L_IDLE: Serial.println("Idle mode"); break;
case HMC5883L_SINGLE: Serial.println("Single-Measurement"); break;
case HMC5883L_CONTINOUS: Serial.println("Continuous-Measurement"); break;
default: Serial.println("Bad mode!");
}

Serial.print("Selected Data Rate: ");
switch (compass.getDataRate())
{
case HMC5883L_DATARATE_0_75_HZ: Serial.println("0.75 Hz"); break;
case HMC5883L_DATARATE_1_5HZ: Serial.println("1.5 Hz"); break;
case HMC5883L_DATARATE_3HZ: Serial.println("3 Hz"); break;
case HMC5883L_DATARATE_7_5HZ: Serial.println("7.5 Hz"); break;
case HMC5883L_DATARATE_15HZ: Serial.println("15 Hz"); break;
case HMC5883L_DATARATE_30HZ: Serial.println("30 Hz"); break;
case HMC5883L_DATARATE_75HZ: Serial.println("75 Hz"); break;
default: Serial.println("Bad data rate!");
}

Serial.print("Selected number of samples: ");
switch (compass.getSamples())
{
case HMC5883L_SAMPLES_1: Serial.println("1"); break;
case HMC5883L_SAMPLES_2: Serial.println("2"); break;
case HMC5883L_SAMPLES_4: Serial.println("4"); break;
case HMC5883L_SAMPLES_8: Serial.println("8"); break;
default: Serial.println("Bad number of samples!");
}

}

void loop() {
OSCMessage msg("/trigger/prophet");
msg.add("hello, osc.");
Udp.beginPacket(outIp, outPort);
msg.send(Udp);
Udp.endPacket();
msg.empty();
delay(500);

Vector raw = compass.readRaw();
Vector norm = compass.readNormalize();

Serial.print(" Xraw = ");
Serial.print(raw.XAxis);
Serial.print(" Yraw = ");
Serial.print(raw.YAxis);
Serial.print(" Zraw = ");
Serial.print(raw.ZAxis);
Serial.print(" Xnorm = ");
Serial.print(norm.XAxis);
Serial.print(" Ynorm = ");
Serial.print(norm.YAxis);
Serial.print(" ZNorm = ");
Serial.print(norm.ZAxis);
Serial.println();

}`

problem with esp32

Your lib seems to be very good but i have a problem with esp32

with wire lib are you using because i have problem of

MPU6050_temperature:20:14: error: 'class MPU6050' has no member named 'begin'

while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))

Could not find a valid HMC5883L sensor, check wiring!

I get this error message.
The device is connected to pin 21 and pin22.

With the ESP-IDF and the i2cscan sample, I have to declare the i2c pins first. Here I can not find this possibilty.
With the ESP-IDF I can read out the connected device once this is configured.

2024-02-27 10_04_28-ESP-IDF Welcome - i2c_tools - Visual Studio Code

extra semicolons

This is pretty minor but the compiler threw an error in HMC5883L.cpp because of extra ; after #endif on lines:

220
245
272

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.