Go Down

Topic: Pololu MinIMU-9 v2 (Read 1 time) previous topic - next topic

minnnnnas

Hello,
I just got this sensor and tried to run the code found in the site. The L3G one.

But when im compiling it on arduion interface i get these errors;

"Serial:4: error: 'L3G' does not name a type
Serial.ino: In function 'void setup()':
Serial:10: error: 'gyro' was not declared in this scope
Serial:16: error: 'gyro' was not declared in this scope
Serial.ino: In function 'void loop()':
Serial:20: error: 'gyro' was not declared in this scope
"

I have dowloaded the file from site and extracted it to libraries forlder on my arduino folder
I just running it from file->examples->L3G->serial

The code is the following.
I'm kinda newbee in programming so please enlighten me.


#include <Wire.h>
#include <L3G.h>

L3G gyro;

void setup() {
  Serial.begin(9600);
  Wire.begin();

  if (!gyro.init())
  {
    Serial.println("Failed to autodetect gyro type!");
    while (1);
  }

  gyro.enableDefault();
}

void loop() {
  gyro.read();

  Serial.print("G ");
  Serial.print("X: ");
  Serial.print((int)gyro.g.x);
  Serial.print(" Y: ");
  Serial.print((int)gyro.g.y);
  Serial.print(" Z: ");
  Serial.println((int)gyro.g.z);

  delay(100);
}

Thank you in advance
Minas

Chagrin

It would appear that you do not have the L3G library installed properly. Further up in your output there should also be an error stating that it cannot find the file L3G.h referenced in your #include statement.

minnnnnas

Which is the correct way to install a library?

I just download the zip file from the site and then extracting it in the library folder.

Is there another way or am i doing it wrong?

Chagrin


minnnnnas

Thank you alot for your help. Turned out that i was abit dizzy... i was exctracting the whole folder with readme etc and not the certain one that included the files. :smiley-red:

Thank you again.

Go Up