Firmata - can't live with it, can't live without it

Hi,

I’m fairly new to the Arduino. I have a Neopixel WS2812b strip that works nicely with the Arduino, the Fastled DemoReel100 is AWESOME and I’m getting a grasp on how to program the strip myself.

But my plan is to input simple digital data from Ableton to the Arduino using the Max for Live Arduino connection kit, and use that data to trigger different ledstrip patterns. I have had some success with this: I can load the StandardFirmata on the Arduino, run the Ableton M4L Arduino connector and switch on and off a single Led connected to digital pin 13. By assigning pin 13 in the Ableton device to a macro I can make the led flash every time the kick drum of a dance track plays - which is very cool :slight_smile:

But I seem to be in an either/or situation with the Firmata script running in the Arduino. I need to combine the StandardFirmata functions with Neopixel-type scripts, but I don’t really understand (other than at a general level) what StandardFirmata is doing. I suspect that some/most of the StandardFormata code isn’t required for just writing digital on/offs to Arduino pins - I need to know what is essential for my purpose and what isn’t.

All my attempts to write a custom sketch that will receive info from the Ableton Max Arduino device and trigger either the LED strip or just an Led stuck directly into a pin and ground have failed. The Ableton device so far only works when StandardFirmata is installed.
Example modified from an “LED ushbutton” sketch of the kind of thing I’m trying (but which doesn’t work):

#include <FastLED.h>    //tells it to use the FastLED library, always use this.
#define NUM_LEDS 150    // Creates variable NUM_LEDS to equal 150, always use this. 
#define DATA_PIN 6      // Which data pin, always use this.
   
CRGBArray<NUM_LEDS> leds;    //creates an array in memory of 150 leds called "leds",  always use this. 

// digital pin 2 has a pushbutton attached to it. Give it a name:
int abletonIN = 7;     //random, doesn't matter which
int stripOUT = 6;

// the setup routine runs once when you press reset:

void setup() {
 // set the led type 
 FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);   //Tell it the LED type i.e. NEOPIXEL
 // initialize serial communication at 9600 bits per second:
 Serial.begin(9600);
 // make the pushbutton's pin an input:
 pinMode(abletonIN, INPUT);
}

// the loop routine runs over and over again forever:
void loop() {
 // read the input pin:
 int buttonState = digitalRead(abletonIN);
 //int buttonState = 1;
if (buttonState = 1)
 {
 // action A
 fill_gradient_RGB(leds,0,CRGB(255,0,0),NUM_LEDS-1,CRGB(0,255,0) );   
 FastLED.show();
 delay(500);  
 }
else
 {
 // action B
 fill_solid(leds, NUM_LEDS, CRGB::Black); // Set all 150 to red.
 FastLED.show();       
     delay(500);
 }
}

Can anyone advise? Which (relatively simple) set of commands will enable comms between the Ableton device and the Arduino, so I don’t have to use the Fermata ?

Many thanks!

Try to look at the top post in this forum: How to use this forum

Hint: Use code-tags.

// Per.

Fixed it, sorry about that - wasn't aware of that function.

I guess what I'm hoping for is pointers towards which parts of the standardfermata I need for the Arduino to accept basic digital high/low from the Max for Live arduino device - just a general pointer and I can research the rest myself.