ADXL345 accelerometer with neopixel

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
ssk8
 
Posts: 2
Joined: Sun Nov 03, 2013 12:37 am

ADXL345 accelerometer with neopixel

Post by ssk8 »

I'm having a problem with the Adafruit_ADXL345 Triple-Axis Accelerometer when used in conjunction with the Adafruit_NeoPixel. Specifically, the Arduino appears to freeze when calling the gyro if the neopixel library is loaded. Both example programs work fine on their own but fail together on both Uno and Leonardo(micro) boards.
I've also tested the neopixel library with the L3GD20 Gyro breakout and found that they work together when the gyro is interfaced with SPI but not with I2C. I've only interfaced the ADXL345 as I2C because SPI doesn't appear to be supported in the library. Just for S&G's, I also tried an adafruit I2C LCD shield with the neopixel library and found they do work together suggesting that I2C/Wire library can work with the Adafruit_NeoPixel library.

In case my query isn't clear, I've included a minimal sketch which demonstrates the problem. This sketch dimly lights 16 neopixels on pin 6 (I also tried others) but uncommenting either accel line results in no pixels being lit.

Code: Select all

#include <Adafruit_NeoPixel.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_ADXL345.h>
Adafruit_ADXL345 accel = Adafruit_ADXL345(14325);
Adafruit_NeoPixel strip = Adafruit_NeoPixel(16, 6, NEO_GRB + NEO_KHZ800);
void setup() {
  strip.begin();
  strip.show();
// accel.setRange(ADXL345_RANGE_16_G);
}
void loop() {
  sensors_event_t event; 
//  accel.getEvent(&event);
 for(uint16_t i=0; i<=strip.numPixels(); i++) {
      strip.setPixelColor(i, strip.Color(1, 1, 1));
      strip.show();
 }
 delay(100);
}
Is there just an incompatibility in the libraries?
thanks, c

User avatar
adafruit_support_bill
 
Posts: 88097
Joined: Sat Feb 07, 2009 10:11 am

Re: ADXL345 accelerometer with neopixel

Post by adafruit_support_bill »

Are you missing a call to accel.begin()?

I haven't tried that combination, but I've had no problems at all with the LSM303 accelerometer via i2c with the neopixels: http://learn.adafruit.com/steam-punk-go ... ementation

ssk8
 
Posts: 2
Joined: Sun Nov 03, 2013 12:37 am

Re: ADXL345 accelerometer with neopixel

Post by ssk8 »

Spot on! Thank you so much!

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”