-1

I am currently creating an app, where my Android phone continuously sends a Color-Integer to my Arduino. After that, the single RGB-Channels are parsed and sent to the Neopixel. I get a horrible flickering effect. Thus, I get some "?" in my Serial Monitor. Without the Neopixel connected, everything just seems to work fine (regarding the receiving and parsing of the Color). Is there any way to fix that Bluetooth-Neopixel-Problem?

My Code on Arduino-Site is the following:

void loop() {
   if (bluetooth.available()){
      current = bluetooth.read();
      if(current == endChar) {
        if(msg[0] = 'C') { // The first Character is the "key" to be received on Arduino
          colorChange(msg);
        } else if(msg[0] == 'S') {
           fadeMode = true;
        }
        msg = "";
      } else {
        msg+=current;
      }
  }
}

void colorChange(String msg) {
  //fadeMode = false;
  msg.remove(0,1);
  currentColor = atol(msg.c_str());
  red = (currentColor >> 16) & 0xFF;
  green = (currentColor >> 8) & 0xFF;
  blue = currentColor & 0xFF;
  for(int i = 0; i < NUMPIXELS; i++) {
    pixels.setPixelColor(i, pixels.Color(red, green, blue));
  }
  pixels.show();
}
jannis
  • 1
  • 2
  • I'm voting to close this question as off-topic because it looks like a hardware problem, not programming. – gre_gor Oct 15 '18 at 14:22

1 Answers1

0

does your neopixel work correctly when you upload a test code that's known to work ? if it does i would try to change the part where you pass the bluetooth color values to the neopixel or even removing it and adding it part by part to see where the problem comes from. i suppose that you already tried looking at the values received by the arduino on the serial monitor to verify that the flickering is not actually from the android side .