Using fastled and neopixel in control surface.

Hello,.

I am trying to replace output pins and put neopixels ws2812b..

Got this code

#include <FastLED.h>
#include <Control_Surface.h>

USBMIDI_Interface usbmidi;  

#define NUM_LEDS 8
#define DATA_PIN 15
CRGB leds[NUM_LEDS];

Bank<8> bankpotspedal(4);       /bank named bankpotspedal,4 values and 8 bank positions

Bankable::CCPotentiometer potspedal[] =  //input object, CCpotentiometer::bankable in "bankpotspedal" bank, PIN 
                                         24 and CC 1 address. Will increase or decrease 4 values each
                                            bank position.
{ 
  {bankpotspedal, 24, 1},    
  {bankpotspedal, 25, 3},
  {bankpotspedal, 26, 4},
};

CCPotentiometer potspedal2 [] = 
{
  {22, 115},            // input object, CCPotentiometer and named "potspedal2",Pin 22 and 115 CC MIDI address
  {23, 2},             // input object, CCPotentiometer and named "potspedal2",Pin 23 and 2 CC MIDI address
};

IncrementDecrementSelectorLEDs<8> bankSelector = 
{                
  bankpotspedal,                        //bank name
  {11, 12},                             // button pins
  {27, 28, 29, 30, 31, 32, 33, 34},     // LED pins
}; 

void setup()
{

  Control_Surface.begin();
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(50);

}

void loop() 
{
 Control_Surface.loop();
}

I don´t know where to get info..
I want to replace OUTPUT pins {27, 28, 29, 30, 31, 32, 33, 34} from incrementdecrementselectorleds..
and change it to neopixels (for example...pin 27 will be neopixel(0) ; pin 28 will be neopixel (1),and so on..

Thanks

You cannot use Neopixels as output pins for the LEDs. (Well, you could implement the ExtIO digitalWrite interface for Neopixels, but I'm not sure what colors “HIGH” and “LOW” should represent.)

If you look at the source code for IncrementDecrementSelectorLEDs, you'll see that it's a specialization of the GenericIncrementDecrementSelector with the SelectorLEDsCallback. The easiest way is to implement your own callback, call it SelectorFastLEDCallback, for example. Just implement the begin and update methods, where you actually set the colors for the FastLED library. Then compose your callback with the GenericIncrementDecrementSelector just like it's done for IncrementDecrementSelectorLEDs.
You can do all of this in your sketch, there's no need to edit the library files.

You'll need to be familiar with C++ class templates, methods, constructors and initialization. I can't guide you through this right now, but you can consult online tutorials such as learncpp.com, for example.

Pieter

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.