Go Down

Topic: Can't get accelerometer to work with rgb led (Read 100 times) previous topic - next topic


We've connected an addressable RGB LED to our Arduino Uno and successfully got it to display whatever colors we needed. It uses the Adafruit Neopixel library located here: https://github.com/adafruit/Adafruit_NeoPixel

Unfortunately, when we added in code to receive the x, y, and z values from the accelerometer, the led stops working. So we're just trying to figure out why the LED stops working after the analogReads. Any help is appreciated.

here is the code:

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>

#define PIN 8

Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_RGB);

int accel_x, accel_y, accel_z;
int r, g, b;

void setup() {


void loop() {
  accel_x = analogRead(0);
  accel_y = analogRead(1);
  accel_z = analogRead(2);

  strip.setPixelColor(0, strip.Color(0, 255 , 0));

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131