Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino IDE Error: Library Not Valid #6

Open
SparrowTheNerd opened this issue Mar 30, 2023 · 5 comments
Open

Arduino IDE Error: Library Not Valid #6

SparrowTheNerd opened this issue Mar 30, 2023 · 5 comments

Comments

@SparrowTheNerd
Copy link

image

STEPS TO REPRODUCE: In Arduino IDE, navigate to Sketch, Manage Libraries, Install .zip Library, and select the latest release of this library. The error is thrown.

@SparrowTheNerd
Copy link
Author

SparrowTheNerd commented Mar 30, 2023

FIX: Replace "library.json" with "library.properties" as follows:

name=Arduino-LSM6DSO32
version=1.1.2
paragraph=PlatformIO / Arduino library for the LSM6DSO32 inertial module
url=https://github.com/TeamSunride/Arduino-LSM6DSO32.git
author=Samuel Scott
maintainer=Samual Scott
architectures=*

@SparrowTheNerd
Copy link
Author

SparrowTheNerd commented Mar 30, 2023

Additionally to view the examples within the Arduino IDE they would need to be renamed to .ino files and packaged inside folders with their same name

@danverstom
Copy link
Member

FIX: Replace "library.json" with "library.properties" as follows:

name=Arduino-LSM6DSO32
version=1.1.2
paragraph=PlatformIO / Arduino library for the LSM6DSO32 inertial module
url=https://github.com/TeamSunride/Arduino-LSM6DSO32.git
author=Samuel Scott
maintainer=Samual Scott
architectures=*

Hi, did you check to make sure that the library fully works when using this method? It has some other dependencies that I want to make sure were also installed

@SparrowTheNerd
Copy link
Author

SparrowTheNerd commented Mar 30, 2023

Hi, did you check to make sure that the library fully works when using this method? It has some other dependencies that I want to make sure were also installed

I wasn't sure how to make it require other dependencies to be honest, but I found that even upon installing those dependencies I was unable to get the whole library to work. I was getting errors about there being several void setup() functions due to the existence of the main.cpp file in the library folder. I tried deleting this file, but now using I2C with this library the serial monitor displays nothing. Additionally, I had to modify the I2C initialization line as it was missing a relevant portion of the code. The line needs to be preceded with

LSM6DSO32::

For additional information, this is the code I am using, which is example code provided in the library with additional debug lines to Serial. The i2c protocol constructor has been modified to not throw an error. The installed libraries are LSM6DSO32, Protocol, Vector, and FIFO. None of the serial println commands, even the first one just after Serial.begin, are printing which leads me to believe there is some more significant issue. My board is not the problem, it works on my code just fine but I really wanted a library with FIFO to make working on this easier.
Evidence points to the I2C initializer being the problem, because when using the SPI initializer stuff does print to Serial, it's just garbage because the chip isn't connected to SPI

/*
 * An example of how the LSM6DSO32 can be used by reading directly from the accel and gyro registers
 * The built-in Fifo is not being used.
 *
 */


#include <Arduino.h>
#include <LSM6DSO32.h>

// The LSM6DSO32 can be used with either SPI or I2C, and this library supports both, using Protocol: https://github.com/TeamSunride/Protocol
// #define CS_pin 40
// LSM6DSO32::LSM6DSO32 LSM(CS_pin, SPI, 4000000); // spi protocol constructor
LSM6DSO32::LSM6DSO32 LSM(&Wire,100000); // i2c protocol constructor


void setup() {
    // Setup Serial on 115200 baud
    Serial.begin(115200);
    Serial.println("Serial open");

    // begin() initialises the communication protocol.
    LSM.begin();
    Serial.println("LSM Initialized");

    // default_configuration() configures the device. - Specific settings can be set after calling this:
    LSM.default_configuration();
    // for example:
    // LSM.set_interrupts_active_low(false);
    Serial.println("Setup complete");
}

void loop() {
    // directly read from the accel and gyro registers - not using the fifo
    Vector<double, 3> acc = LSM.get_accel();
    Vector<double, 3> gyr = LSM.get_gyro();
    Serial.println("Vectors created");
    Serial.print("Acc: ");
    Serial.print(acc[0]); Serial.print(", ");
    Serial.print(acc[1]); Serial.print(", ");
    Serial.print(acc[2]);

    Serial.print("Gyr: ");
    Serial.print(gyr[0]); Serial.print(", ");
    Serial.print(gyr[1]); Serial.print(", ");
    Serial.print(gyr[2]);

    // Be aware of the ODR (Output data rate) that is set - reading at a rate higher than this means you will be reading stale data when using direct reads.
    // Note: The ODR can be set in setup() using e.g.    LSM.set_accel_ODR(OUTPUT_DATA_RATES::ODR_833_HZ);    and     LSM.set_gyro_ODR(OUTPUT_DATA_RATES::ODR_833_HZ);
    delay(10);
}

@robosam2003
Copy link
Member

Should be all fixed now - I've removed the main.cpp from the git, and added a library.properties file for compatibility with the Arduino IDE.

I've never experienced any issues with the I2C initialiser, I ran the code you posted above and it seemed to work with no issues:
image

For more on our multi-protocol implementation that we use, see https://github.com/TeamSunride/Protocol

Could you try again with the new version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants