Pages: [1]   Go Down
Author Topic: Pololu MinIMU-9 v2  (Read 1201 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 1
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2511
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2511
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://arduino.cc/en/Guide/Libraries

Note the "restart" part.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: