How to merge sketches to change button press/ patterns on Bluefruit

Hello All,

I have a Bluefruit Feather MO board using the attached “feather_bluefruit_neopixel_animation_controller” sketches (BluefruitConfig.h, feather_bluefruit_neopixel_animation_controller.ino & packetParser.cpp) that I can control via bluetooth using the Blufruit app. I have connected a ws2815b strip of 72 LEDs (60 per M). I am able to toggle between the 4 modes in the sketch correctly

What I am trying to do is change button 1 to be the “Double Fire Ring” pattern and button 2 to be the “Cylon” pattern. I have these 2 sketches working on an Arduino Uno and want to merge them onto the Feather M0 board.

It appears that the “feather_bluefruit_neopixel_animation_controller” sketch is written with “Adafruit_NeoPixel pixel” commands while the “Double Fire Ring” and “Cylone” sketches are written with the “Adafruit_NeoPixel strip” commands.

Adding the code here exceeds the maximum allowed length (9000 characters).

  1. Is it possible, and how could I replace button 1 and button 2 patterns to work as the “Double Fire Ring” and “Cylon” pattern?

  2. Are there other Bluetooth apps that will work with the Adafruit Feather M0 board that will allow for more than 8 button modes?

The Adafruit Bluefruit app only has buttons 1-4 and 5-8 as up, down, left and right. I would like to have possibly 20 modes, i.e. strobe, color fade, etc.

Any assistance would be greatly, greatly appreciated!

Double_Fire_Ring.ino (2.9 KB)

Cylon.ino (2.04 KB)

feather_bluefruit_neopixel_animation_controller.zip (8.14 KB)

You have:-

Adafruit_NeoPixel pixel = Adafruit_NeoPixel(NUMPIXELS, PIN);

This creates an instance of the libiary using the variable pixel, so you use methods with the calls like

pixel.show()

Then you have:-

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);

This creates an instance of the libiary using the variable strip, so you use methods with the calls like

strip.show()

If you were to define the variable as knickers with:-

Adafruit_NeoPixel knickers = Adafruit_NeoPixel(NUMPIXELS, PIN);

You could use:-

knickers.show()

In other words you can use any variable name to hold an instance. If you want to put them in the same sketch then only have on instance of the libiary and use it's name in methods like show.

Thank you for the follow up. The only problem is I’m new to this and not sure of commands/ syntax for each variable. Is it possible to just replace the “pixel” variable and overwrite with “strip”?

Im sure it is not, but is a quick ask. Is there some kind of translator or specific reading I could find on how to rewrite the codec for pixel vs strip?

I am assuming this is not so easy

Is it possible to just replace the "pixel" variable and overwrite with "strip"?

Yes. Remember to do it for all mentions of the variable name.

You can use the find and replace option under the edit menu of the IDE application to do this if you like.