I'm attempting to connect a L3GD20H 3-Axis Gyro to an Arduino Micro and run the sample code from the Adafruit_L3GD20_U library, called "sensorapi". Here is the code, unedited:
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_L3GD20_U.h>
/* Assign a unique ID to this sensor at the same time */
Adafruit_L3GD20_Unified gyro = Adafruit_L3GD20_Unified(20);
void displaySensorDetails(void)
{
sensor_t sensor;
gyro.getSensor(&sensor);
Serial.println("------------------------------------");
Serial.print ("Sensor: "); Serial.println(sensor.name);
Serial.print ("Driver Ver: "); Serial.println(sensor.version);
Serial.print ("Unique ID: "); Serial.println(sensor.sensor_id);
Serial.print ("Max Value: "); Serial.print(sensor.max_value); Serial.println(" rad/s");
Serial.print ("Min Value: "); Serial.print(sensor.min_value); Serial.println(" rad/s");
Serial.print ("Resolution: "); Serial.print(sensor.resolution); Serial.println(" rad/s");
Serial.println("------------------------------------");
Serial.println("");
delay(500);
}
void setup(void)
{
Serial.begin(9600);
Serial.println("Gyroscope Test"); Serial.println(" ");
/* Enable auto-ranging */
gyro.enableAutoRange(true);
/* Initialise the sensor */
if(!gyro.begin())
{
/* There was a problem detecting the L3GD20 ... check your connections */
Serial.println("Ooops, no L3GD20 detected ... Check your wiring!");
while(1);
}
/* Display some basic information on this sensor */
displaySensorDetails();
}
void loop(void)
{
/* Get a new sensor event */
sensors_event_t event;
gyro.getEvent(&event);
/* Display the results (speed is measured in rad/s) */
Serial.print("X: "); Serial.print(event.gyro.x); Serial.print(" ");
Serial.print("Y: "); Serial.print(event.gyro.y); Serial.print(" ");
Serial.print("Z: "); Serial.print(event.gyro.z); Serial.print(" ");
Serial.println("rad/s ");
delay(500);
}
The code compiles and uploads to the Micro with no errors. However, nothing appears in the Serial Monitor when I open it. What could I be missing here?
I know the first thing to do is check connections, so these are where my wires are going:
Micro L3Gd20H
5 V --> V in
GND --> GND
A4 --> SDA
A5 --> SCL