Hey all
I am experiencing a rather strange problem with both the Adafruit 9-DoF and the Adafruit 10-DoF accelerometer on a particle photon.
Except instead of using port A4 and A5, i’m using D0 as SDA and D1 as SCL, and naturally the Photon only supplies 3.3V.
Using the library https://github.com/pkourany/Adafruit_9DOF_Library/blob/master/examples/tester/tester.ino and example code from there, i got my code to work, but after a while it started behaving strangely, and finally stopped working all together.
Basically i follow this example:
#include "Adafruit_Sensor.h"
#include "Adafruit_LSM303_U.h"
#include "Adafruit_9DOF.h"
/* Assign a unique ID to the sensors */
Adafruit_LSM303_Accel_Unified accel = Adafruit_LSM303_Accel_Unified(30301);
void setup(void)
{
Serial.begin(115200);
/* Initialise the sensors */
if(!accel.begin())
{
/* There was a problem detecting the ADXL345 ... check your connections */
Serial.println("Ooops, no LSM303 detected ... Check your wiring!");
while(1);
}
}
void loop(void)
{
/* Get a new sensor event */
sensors_event_t event;
/* Display the results (acceleration is measured in m/s^2) */
accel.getEvent(&event);
Serial.print("ACCEL ");
Serial.print("X: "); Serial.print(event.acceleration.x); Serial.print(" ");
Serial.print("Y: "); Serial.print(event.acceleration.y); Serial.print(" ");
Serial.print("Z: "); Serial.print(event.acceleration.z); Serial.print(" ");Serial.println("m/s^2 ");
Serial.println("");
delay(1000);
}
But after a while, the loop simply stops when running the line:
accel.getEvent(&event);
This has happened three times now with two different 10-DoF and a 9-DoF.
Frankly i’m stumped.
Do any of you have an idea about what could be happening?