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