Connecting LED Light Strip (NeoPixels) to Max


    Dec 06 2014 | 6:58 pm
    good morning community,
    I have been trying to get this Arduino LED light strip (https://learn.adafruit.com/adafruit-neopixel-uberguide/overview) to respond to audio data coming from Max.
    It's clear that this will be awesome, and after a few projects using Maxuino to communicate to Arduino, I blithely figured I'd be able to do it easily. But now that I'm checking out the Arduino code that controls the NeoPixels... (https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library) I fear that it is not possible for Maxuino to communicate to the NeoPixels. Does anyone have any experience with stuff like this, or any advice?

    • Dec 06 2014 | 7:52 pm
      Is there any way of having data from Max change parameters in Arduino code?
    • Dec 06 2014 | 8:45 pm
      Max can send data to the Arduino as input to a [serial] object that is talking to the Arduino. Since you are free to program the Arduino as you please, you can devise your own protocol to handle incoming data. E.g.:
      if(Serial.available() > 0) { int incoming = Serial.read();
      switch(incoming) { case 0: // etc.
      An incoming integer can be interpreted by the Arduino as a change of a certain parameter.
      Good luck!
    • Dec 06 2014 | 9:09 pm
      Thanks so much for the helpful response HZ37! So, if I understand correctly, I can upload some NeoPixel-control-ready code onto my Arduino, and then I make it so the parameters for controlling the LEDs are input by a [serial] object that will be coming from Max via something like Arduivis?
      I used Maxuino in the past, for which I had to upload StandardFirmata onto my Arduino--but in this case, I really need some code written specifically for the NeoPixels to be uplaoded to the Arduino, and I just need to change some parameters in that code from Max.
    • Dec 06 2014 | 9:37 pm
      Yes, hook up the neopixel library to your Arduino. First test if you grasp what the code does, if you can turn leds on and off. Once you've got that all working, add the loop-code that intercepts Serial commands. Don't try to do it all at once, because that can be just frustrating. Adafruit is usually very clear and well documented, so this should be no exception. Good luck and have fun! And you can always post questions to specific situations that you can't figure out here. I do interfacing between Max and Arduinos, so I might be able to say something meaningful.
    • Dec 06 2014 | 10:55 pm
      i don't have a neopixel to test right now, but i recently saw a tutorial where you can just send a string via serial object to set individual pixels of a neopixelstrip: http://www.tigoe.com/pcomp/code/arduinowiring/1172/ Maybe you can test it and post back if it works reliably..
      all the best
    • Dec 07 2014 | 1:39 am
      Nice link, Tobias. I'm still waiting for the perfect "jitter matrix to lights" algorithm, but until then this will make it easier to experiment on smaller setups.
    • Dec 07 2014 | 2:43 am
      yeah, I am also curious if it would work just like this:(in that case it might also help to add an extra condition in the Arduino Code to only refresh the strip after the last Channel has been set - instead after every pixel)
    • Dec 07 2014 | 3:05 am
      This is fantastic help HZ37 and Tobias! I will try it out later tonight and report my findings--many thanks.
    • Dec 07 2014 | 4:26 am
      :0!
      You should've seen my face when I got my first NeoPixel LED to light up through Max! A mixture of shock, terror, and delight!!! (I used the delightfully simple Arduino code you provided Tobias, via Tim Igoe)
      Then, when I banged your neat jit patch into the serial port, and 60 LEDs blasted my room full of candycane lights... it was one of the high points of my life.
      Thank you for your help!!!
    • Dec 07 2014 | 4:48 am
      To be extra clear: I uploaded this code to my Arduino Uno http://www.tigoe.com/pcomp/code/arduinowiring/1172/
      and then I loaded up this patch
      I chose my USB serial port for my Arduino, and hit the bang button, and 60 messages in the format of "C int1 int2 int3 int4" were banged into the serial port. int1 is the LED on my NeoPixel strip I want to control, and int2-4 are the RGB values, on a scale of 0-255.
      Now onto my loftier goal: I want to map the running playback location of the play~ object onto this strip of lights, so as I live-loop my piano playing, I can have this strip of LEDs draped over my piano--giving a visual representation of the looping playback.
      Would the above method of inputting serial commands be appropriate for this kind of procedure? I might have a 3 second loop, in which case (if I used a 30 LED strip) I would need to turn on and off ~10 LEDs in a second. Any advice would be greatly appreciated.
    • Dec 07 2014 | 5:28 am
      try this one out to get close:
    • Dec 07 2014 | 5:58 am
      Ahh!! Thank you Wetterberg, that is extraordinarily helpful!--I would never have figured that out tonight. The playback beautifully lights up the first 28 LEDs, and then clears them and resets to the beginning when the recording is reaches the end. Now that you've really gotten the ball rolling, I'm going to experiment further--try and make this work with my live-looper (it's based on Robert Henke's Granulator II, and I want each light to represent a grain's playback location, like in the display panel of that instrument).
    • Dec 07 2014 | 7:34 am
      I've made a few small adjustments to your code Wetterberg and it's working like a dream on a live-looper I built--thanks again. I'm gonna work on the Granulator project through the night.
      I was wondering if anyone had any advice for modifying this Arduino code (http://www.tigoe.com/pcomp/code/arduinowiring/1172/) per the advice of Tobias: "...it might also help to add an extra condition in the Arduino Code to only refresh the strip after the last Channel has been set – instead after every pixel"
      As it is now, there's noticeable latency in sending commands to all the pixels (e.g. clearing them--they clear one at a time down the line). This fix seems very simple but I am totally unfamiliar with Arduino text-based code
    • Dec 07 2014 | 11:11 am
      Alright! I've gotten it so every grain output from Granulator II is presented on this NeoPixel strip, this is extremely awesome visualization of granular synthesis except unfortunately there is some very serious latency between the data input into the serial port and the displaying of the NeoPixel lights. After I stop inputting data to the Arduino, it has taken up to 20 seconds to finish displaying all the data I sent it. Any advice?
      Using this Arduino code: http://www.tigoe.com/pcomp/code/arduinowiring/1172/ and this max patch
    • Dec 07 2014 | 3:40 pm
      What model of arduino are you using ?
    • Dec 07 2014 | 3:44 pm
      Just saw you were using the uno. The serial communication speed of the uno is quite slow if you need to control several leds at a fast fps... If you're looking for a faster solution you should check the Teensy 3.1 It has a lot more ram than the uno meaning you can adress more leds. Also the serial speed is 12mbps which is way faster than what the uno can achieve. It's also cheaper !
    • Dec 07 2014 | 3:51 pm
      @wetterberg I've been using the matrix to leds approach for a while now and it works quite well.
      The basic logic is to send a full frame worth of data to the serial object. I use jit.iter going through a zl group to the serial port. In the arduino/teensy code I then read in the number of bytes representing a frame and then display it.
    • Dec 07 2014 | 6:10 pm
      Hey Nat, thanks for the response. I'm sending floating points in rapid succession to the serial port, but I didn't expect it to be more data than the Uno could process, I figured it was something inefficient about the code I'm working with. Do you have any comments on the Arduino and Max code I'm posted above your comment? And could you post your approach, it'd be great to see :)
      As far as upgrading to the Teensy 3.1, is that a 3.3V microcontroller? I understand some folks have had some headaches getting those to work with the NeoPixels (http://forum.pjrc.com/threads/15769-Feasible-to-drive-Adafruit-Neopixel-LED-strip). I'm using a 30LED/meter strip. If you think that's the source of my problem, I'd be likely to pick one up today!
    • Dec 07 2014 | 6:30 pm
      "I’m sending floating points in rapid succession to the serial port"
    • Dec 07 2014 | 6:34 pm
      You also need to keep in mind that serial ports are usually optimized for a certain buffer size. It is often more efficient to send a big chunk of data than a smaller chunk... I'll try to find the thread where I posted some led code.
    • Dec 07 2014 | 6:47 pm
      On the Max side it could look like this :
      My Teensy code looks like this:
      The Teensy is indeed a 3.3v controller. I had luck with the different strips I used, usually a ~100ohms resistor between the teensy pin and data pin of the strip will sort things out. Otherwise you can level shift quite easily. There is also a cheap adaptor that does all the level shifting for you: https://www.pjrc.com/store/octo28_adaptor.html
    • Dec 07 2014 | 8:25 pm
      Thanks for the postings Nat! It might be too late for me to pick up a Teensy for my project, so I'm trying to make it work with the Arduino. I've set the buffer size to the max for the Uno, 64 characters at a time. My data is converted to ASCII--something that I noticed you didn't do in your patch--do you do it in the Teensy code?
      I'm getting a bit frustrated, I'm sending my NeoPixels 1/4th the data and filling up the buffer but there's still a lot of latency. Any other ideas? Or is my Uno just incapable?
    • Dec 07 2014 | 8:57 pm
      Well, when you send data through the serial port, ultimately it always sends bytes (between 0-255) wether you interpret it as ascii or as a number is up to the receiving side. Are you sending chunks of 64 bytes at a time or still sending one pixel worth of data ?
    • Dec 07 2014 | 9:24 pm
      I'm using zl group to send out chunks of 64 bytes at a time. My friend (who knows a bit about Arduino code) timed the latency of my Arduino code, (if his tests are correct) it takes ~22 ms to set an individual LED, and as each LED represents a grain of audio
      I'm starting to think the demands of Granulator II are just crazy. Each playback voice has by default two grains going simultaneously, and each could easily reset every 100ms, and then I sometimes have 6 voices going... that seems to demand a latency closer to 1ms rather than 20ms... I'm going to see if I can modify the input data to make it simpler. I think tracking the individual grain locations might be too much. I'll report back with any findings. Thanks for your help.
      here's my code:
    • Dec 08 2014 | 10:43 am
      I played around with this and eventually ended up using syphon to pipe the data to a processing sketch which passed it on to the teensy.
      It sounds convoluted but I got the best frame rates like this - around 45fps for a 512 pixel matrix.
      There is code for WS2801 pixels here https://cycling74.com/forums/jit-iter-for-driving-rgb-leds/ It is equally possible with WS2812 but you'll need to use a search engine for that one.
      Saying that not sure if I ever tried passing frames to the serial port with the Teensy.
      With an Arduino Uno I found anything more than about 64 pixels meant unacceptably low frame rates.
    • Dec 08 2014 | 10:53 am
      And the one I'm hoping to build one day is like 4-500 pixels, too. Getting 45fps on that would be nuts! that adapter board looks really slick - using ethernet cables is pretty elegant.
    • Dec 10 2014 | 3:27 am
      Thank you all for your help!! Earlier today I got a functional prototype running, here's a video:
    • Apr 18 2015 | 8:14 am
      Hey all: I've been keeping at this project, and I've followed Nat's advice and started working with a Teensy 3.1 with the OctoWS2811 adapter, to visualize granular synthesis. Here's the catch: I'm getting unacceptable lag, even with the Teensy, because I'm struggling to correctly format a full frame worth of data to my serial port (which I understand is 510 bytes). This is a data processing problem that's above my head:
      Currently I am using Tim Igoe's super-simple code http://www.tigoe.com/pcomp/code/arduinowiring/1172/ for sending control data to the NeoPixels. The format is this: "C", followed by LED #, followed by Red value, Green value, and Blue value (e.g. "C 12 255 0 0" would turn LED #12 completely red). Currently this list must be converted into ASCII (using the [atoi] object) before being sent to Tim Igoe's code on the other end of the serial port. When this string is converted to ASCII inside my patch, it becomes a list that contains ~10-16 numbers depending on the LED# and color values input.
      So if my serial buffer is ideally 510 bytes, and I try using zl group to send a list with strictly 510 numbers in it, I am constantly chopping off parts of my "C 12 255 0 0" original message, and my LED display gets screwed up. I need to send the complete un-truncated message, but I need to be more efficient by sending chunks of data larger than ~10-16 numbers. I'd appreciate help from one of you data processing wizards!!
    • Apr 18 2015 | 4:25 pm
      How many leds are you trying to control ?
    • Apr 18 2015 | 4:40 pm
      120 total. Four strips of 30, to represent four granular synths.
    • Apr 18 2015 | 4:55 pm
      Did you check my code ? https://github.com/natcl/MaxLedStrips I've been driving 288 leds at 44fps without issues.
    • Apr 18 2015 | 5:27 pm
      Beautiful code. I will study it more, as I still don't understand everything going on there yet.
      I understand that you're banging out entire jitter matrices to your LEDs at 44Hz, basing the matrices on global effects like color, gradient, or noise. I'm wondering if I could apply this tactic to my project, as my granular synths are currently addressing the individual LED pixels that need to light up or turn off (to represent where the grains are in playing back in my buffer). When I start sending in 5+ granular synth voices, then I am trying to individually address many dozens of LEDs per second, and that's when I get lag.
      Maybe I could gather the data that individually controls my LEDs, and make a matrix out of it that is banged out at 44Hz? Do you have any thoughts?
    • Apr 19 2015 | 2:27 am
      Hey I've been struggling with this all day, and would really appreciate some help. Nat I'm not able to really understand your Teensy code: are you able to individually control the color/duration of each NeoPixel? How should I format the data in Max that's being sent to the serial object?
      Also, is there an ideal way to organize all my data in Max before it's sent to the serial object? If I have 120 NeoPixels, and I need to send RGB data for each one, that's a minimum of 360 values I need to collect in some sort of Matrix that can be sent to the serial object. I'd really appreciate any advice here!!
    • Apr 19 2015 | 3:47 am
      Sure, the Teensy code just waits for a frame determined by the length of the strip and then displays it.
      The idea is to use a jitter matrix as a buffer before sending to the leds. If you want to control individual pixels within the matrix check the setcell1d message.
    • Apr 19 2015 | 4:57 pm
      Very cool Nat, thank you for sharing this and the extra info/advice. Your code is super efficient! I love how I can just keep sending the serial object three RGB values, and it will one by one light up all the LEDs on my strip. I guess I really only need 360 values for my 120 LEDs, without any of this ASCII funny business either. Excellent!
    • Apr 19 2015 | 5:01 pm
      No problem, let me know if you get stuck. Normally you would use a jit.matrix 3 char 120 The matrix has 3 internal planes that reprensent each color. If for example you send it the setcell1d 3 255 0 0 message you will be lighting led number 4 in red.
    • May 06 2015 | 5:57 am
      Hey Nat--thanks so much for all your help and advice, it made a really big difference for the quality of my project. Here's the first performance with the granular-synth/NeoPixel system: https://www.youtube.com/watch?v=kJmxx4ueRBI&feature=youtu.be
    • May 06 2015 | 2:49 pm
      Thanks for sharing !
      Glad it works !
    • May 15 2015 | 2:33 am
      Hi there,
      I'm just trying to control the rgb levels of the pixels on my strip (i am just using 4 pixels). Nothing fancy required, just want to be able to set them using sliders or number boxes .
      Have downloaded both patches, and followed the instructions from these posts (see below) - from Dec 6... Upload to arduino worked fine - and first pixel lights up as directed from code.
      Nothing changes on the LED's when I hit the BANG, It just stays on the original colour uploaded to the 1st pixel. Even though my port recognised and seems to be there
      Sorry for my ignorance, but why is there the append 10 added to the ptch? Also - I don't quite understand, is it necessary to convert through the atoi to send through the serial port?
      Any thoughts/help/pointers etc appreciated
      dREw ----------------
      i don’t have a neopixel to test right now, but i recently saw a tutorial where you can just send a string via serial object to set individual pixels of a neopixelstrip: http://www.tigoe.com/pcomp/code/arduinowiring/1172/ Maybe you can test it and post back if it works reliably..
      all the best
      yeah, I am also curious if it would work just like this:
      – PASTED MAX PATCH, CLICK TO EXPAND. – (in that case it might also help to add an extra condition in the Arduino Code to only refresh the strip after the last Channel has been set – instead after every pixel)
      ------------------------
      To be extra clear: I uploaded this code to my Arduino Uno http://www.tigoe.com/pcomp/code/arduinowiring/1172/
      and then I loaded up this patch
      – PASTED MAX PATCH, CLICK TO EXPAND. – I chose my USB serial port for my Arduino, and hit the bang button, and 60 messages in the format of "C int1 int2 int3 int4" were banged into the serial port. int1 is the LED on my NeoPixel strip I want to control, and int2-4 are the RGB values, on a scale of 0-255.
      Now onto my loftier goal: I want to map the running playback location of the play~ object onto this strip of lights, so as I live-loop my piano playing, I can have this strip of LEDs draped over my piano–giving a visual representation of the looping playback.
      Would the above method of inputting serial commands be appropriate for this kind of procedure? I might have a 3 second loop, in which case (if I used a 30 LED strip) I would need to turn on and off ~10 LEDs in a second. Any advice would be greatly appreciated.
      ------------------------------------
    • May 15 2015 | 5:43 am
      hey Drew,
      I've attached a patch that has comments that may help you.
    • May 15 2015 | 10:42 am
      my mistake sorry -serial port needed a different name - all good now
    • May 17 2015 | 4:02 am
      Thanks a lot for these posts - gave me exactly the start I want and need - I do want to add a brightness control and have had a go in the coding - but not succeeded, this is where and what I added into the arduino code...
      int pixel = 0; // pixel number that you're changing int red = 205; // red value int green = 124; // green value int blue = 75; // blue value
      int bright = 25; // brightness
      then later on i added at end of code i added in the brightness
      if (Serial.available() > 0) { if (Serial.read() == 'C') { // string should start with C
      pixel = Serial.parseInt(); // then an ASCII number for pixel number red = Serial.parseInt(); // then an ASCII number for red green = Serial.parseInt(); // then an ASCII number for green blue = Serial.parseInt(); // then an ASCII number for blue bright =Serial.parseInt(); // then an ASCII number for bright }
      }
      strip.setPixelColor(pixel, red, green, blue);// set the color for this pixel strip.setBrightness (bright); // set the brightness
      strip.show(); // refresh the strip
      }
      Doesn't seem to work -and due to my novice experience with coding etc... not surprising i guess.
      Any help would be appreciated pointing me in the right direction,
      thanks a lot
      dREw
    • Jun 09 2015 | 10:26 pm
      Hello,
      I am student at SJSU. I am working on my BFA show that coming up soon, and I have been asking around for lot of help and getting some answer, but really need help on how to get the Adafruit NeoPixel Digital Strip+MAX/MSP ? I have did the base part which is the firmata part now I need help getting the Adafruit NeoPixel Digital Strip into the MAX/MSP. this where I get lost I has few people show me the patch, but I reall need like a step by step how it all work and how I can get my Adafruit NeoPixel Digital Strip to work. I hate to say this but the way I learn is by seeing image or watching aV video that actually show the step but step how it all work. Reason I am asking lot is because I have disability that case my learning to be only by seeing or watch video with step by step. IF any one of you guys can do that that would be huge help and Then I can do the other on my own( adding the sound into it).
      Please help me out and I know I am asking lot but there are my reason.
      Mikey
    • Jul 16 2015 | 4:26 am
      Hello community!
      I have been working in a project involving max and neopixels and this thread has been very helpful, thanks to everybody!
      I was wondering if any of you have experience with the OctoWS2811 and teensy 3.1, i want to drive 8 led strips with different matrices independently but at the moment i can only work with 8 doing the same pattern, ¿is there any way to tell the teensy how to handle the different matrices? i'm kind of new with coding with arduino, i'm using the code provided by nat https://github.com/natcl/MaxLedStrips, works like a charm, but all my strips are behaving similarly.
      i hope somebody can give me a hint, any help will be very much appreciated !
      Have a great day and thanks for reading!
      L.
    • Jul 16 2015 | 8:33 am
      Hey Luciano,
      Read through this thread more carefully, Nat provides some great code for working with the Teensy and Octo, which I used in my final project that I posted.
      I drove 4 independent matrices, each with 30 LEDs, but instead of telling the TeensyOcto to process matrices through 4 different data wires, I just subtly linked all my 30-LED strips so that my TeensyOcto would understand it as a 120-LED strip (controlled through a single data wire), and the processed that data in Max such that LEDs 1-30 were controlled by one process, LEDs 31-60 were processed by another process, etc.
      Check out the code posted earlier in the forum.
    • Jul 16 2015 | 8:35 am
      Drew--sorry for the 2 month lag in a response. As I understand it, brightness value is a function of the RGB values, not a separate parameter. So an RGB of 10 10 10 will be the same color just much less bright than 255 255 255.
    • Jul 16 2015 | 4:06 pm
      Hi Jaren!
      Thanks for your reply!! i need to process the strips eight separately, they have 240 leds each and the will be placed a few meter away from each other , any idea on how can that be accomplished?
      How did you do to send the values from max to the teensy to control your strips independently ? did you made any modifications to the teesny code?, I'm running the code provided by Nat, it works really good but i don't know how to assign channels in the teensy/octo setup or how to send those values from max to be interpreted the way i need.
      Thanks again for your help and by the way i really enjoyed your grain synth/ neopixels performance!
      L.
    • Jul 16 2015 | 11:18 pm
      Luciano,
      8*240 LEDs is a lot... I hope you know what you're getting yoruself into (the power demands alone are intense). I am a true amateur, I only was able to do this project with the help of people on this form and the Teensy forms. I've attached my Max for Live Neopixels patch (which functions only with input from another granular looper patch, but still can be useful to see). I added notes inside, I'll write them here as well:
      NOTE: This patch works in Max for Live. The "r Neopixel_Data" objects receive parameters from my granular looper in Max for Live. I have 4 seperate NeoPixel strips corrosponding to 4 different loopers.
      (In a nutshell, as the audio playback point moves through my looper's audio buffer, a light moves across the Neopixel strip to show how far through the loop we are)
      The most important part of this patch is the bottom, where "setcell1d $1 $2 $3 $4" accepts four values, the location of the lit LED (in this case, from 1-120), and the RGB value. I randomly generate the RGB value (in "p Color1") and the location of the lit LED is received from the granular looper ("r Neopixel_Data"). Make sure you set the right serial port, which corrponds to whatever port you're using for your Teensy 3.1. I used modified Arduino software to talk to the Teensy (look up how to do this, not too hard).
      Good Luck.
    • Jul 16 2015 | 11:34 pm
      Hi again Jaren!
      Thanks a million for sharing your patch i'll take a look into it tonight!!
      i'm aware that I'm getting into the power issue but i'll try to handle it the best way i can, i'm using the same teensuino setup as you (i guess) to talk to my led strips, for the moment everything works good except for the fact that the jitter matrix is being reproduced equally trough all the led strips ,i'll try to send chunks of jitter matrix to different channels on the teensy/octo, i hope it works.
      i'll keep you updated on how things are developing.
      Thanks again to take the time to response and sharing your knowledge !
      L.
    • Jul 16 2015 | 11:40 pm
      You're very welcome Luciano, the people on this forum helped me immensely and I am happy to return the favor. Good luck with your project.
    • Nov 25 2015 | 9:50 am
      Hey Jaren, thanks for replying earlier - I actually got the brightnes to work fine in the end, thanks... I am trying to use two separate strips using two separate pins i.e. pins 2 & 3 - so each strip can be controlled individually and I can place them far apart from each other -
      Have i missed something in these posts? I just scrolled through again to try and find an answer...
      I've got both strips going on separate pins, by changing the code in the arduino to the following -
      #include
      #define PIN 2 #define PIN 3
      Adafruit_NeoPixel strip_a = Adafruit_NeoPixel(4, 2, NEO_GRB + NEO_KHZ800);
      int pixel = 1; // pixel number that you're changing int red = 255; // red value int green = 24; // green value int blue = 175; // blue value
      int setBrightness = 100;
      Adafruit_NeoPixel strip_b = Adafruit_NeoPixel(4, 3, NEO_GRB + NEO_KHZ800);
      void setup() {
      Serial.begin(9600); // initialize serial communication Serial.setTimeout(10); // set serial timeout
      strip_a.begin(); // initialize pixel strip strip_a.show(); // Initialize all pixels to 'off'
      strip_b.begin(); // initialize pixel strip strip_b.show(); // Initialize all pixels to 'off'
      }
      void loop() {
      but I only have them doing the same thing, any pointers greatly appreciated from anyone - thanks I'm guessing my coding needs work? But not sure where to look - sorry for my being a novice in this area
      dREw
    • Nov 25 2015 | 10:50 am
      sorry sorry sorry - found out how through trial and error.... now am controlling individual pins from the arduino code... using what I've added below. But now I need to figure out how to adjust the max patch to talk to it. I have been using the attached (you need the setPix abstraction also attached) - but not sure how to add to it so it sends o each pin individually.
      // listen for serial:
      if (Serial.available() > 0) { if (Serial.read() == 'C') { // string should start with C
      pixelA = Serial.parseInt(); // then an ASCII number for pixel number redA = Serial.parseInt(); // then an ASCII number for red greenA = Serial.parseInt(); // then an ASCII number for green blueA = Serial.parseInt(); // then an ASCII number for blue
      pixelB = Serial.parseInt(); // then an ASCII number for pixel number redB = Serial.parseInt(); // then an ASCII number for red greenB = Serial.parseInt(); // then an ASCII number for green blueB = Serial.parseInt(); // then an ASCII number for blue
      then assigned each pin a separate code for pixel, red, green, blue - e.g
      int pixelA = 1; // pixel number that you're changing int redA = 255; // red value
      and at the bottom e.g
      strip_a.setPixelColor(pixelA, redA, greenA, blueA);// set the color for this pixel
      strip_a.show(); // refresh the strip
      strip_b.setPixelColor(pixelB, redB, greenB, blueB);// set the color for this pixel
      strip_b.show(); // refresh the strip
      }
    • Nov 26 2015 | 3:31 am
      ok, i now have it all working - I realise it's my lack of really understanding how the lists are sent through the seriel port to the arduino. Anyway, here's the simple patch I've constructed - thanks to all the input from Jaren and everybody here... It's really basic - but just gives a simple interface to operate two separate neo pix strips on different pins (you'll need the abstraction attached 'setPix'.
      I've added the text with the code for the arduino at the bottom
      thanks
      dREw
      #include
      #define PIN 2 #define PIN 3
      Adafruit_NeoPixel strip_a = Adafruit_NeoPixel(4, 2, NEO_GRB + NEO_KHZ800);
      int pixelA = 1; // pixel number that you're changing int redA = 255; // red value int greenA = 24; // green value int blueA = 175; // blue value
      int setBrightness = 100;
      Adafruit_NeoPixel strip_b = Adafruit_NeoPixel(4, 3, NEO_GRB + NEO_KHZ800);
      int pixelB = 2; // pixel number that you're changing int redB = 100; // red value int greenB = 24; // green value int blueB = 255; // blue value
      void setup() {
      Serial.begin(9600); // initialize serial communication Serial.setTimeout(10); // set serial timeout
      strip_a.begin(); // initialize pixel strip strip_a.show(); // Initialize all pixels to 'off'
      strip_b.begin(); // initialize pixel strip strip_b.show(); // Initialize all pixels to 'off'
      }
      void loop() {
      // listen for serial:
      if (Serial.available() > 0) { if (Serial.read() == 'C') { // string should start with C
      pixelA = Serial.parseInt(); // then an ASCII number for pixel number redA = Serial.parseInt(); // then an ASCII number for red greenA = Serial.parseInt(); // then an ASCII number for green blueA = Serial.parseInt(); // then an ASCII number for blue
      pixelB = Serial.parseInt(); // then an ASCII number for pixel number redB = Serial.parseInt(); // then an ASCII number for red greenB = Serial.parseInt(); // then an ASCII number for green blueB = Serial.parseInt(); // then an ASCII number for blue }
      }
      strip_a.setPixelColor(pixelA, redA, greenA, blueA);// set the color for this pixel
      strip_a.show(); // refresh the strip
      strip_b.setPixelColor(pixelB, redB, greenB, blueB);// set the color for this pixel
      strip_b.show(); // refresh the strip
      }
    • Aug 01 2016 | 7:08 pm
      Hi DREWMCM I'm trying something similar and got one strip to work. I also checked your Arduino code which seems very logic, but I can't get Max to talk to it... The pasted Max patch seems to miss connections and has no serial object.... I don't get, how I can differentiate the serial messages for strip A and strip B. Can you point me to the right direction? Thank you very much for any advice!