Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!




Neopixel: Multiple ...
 
Share:
Notifications
Clear all

[Solved] Neopixel: Multiple strips on multiple pins but treated as a continuous strip

2 Posts
2 Users
0 Likes
3,344 Views
(@richardwg)
Active Member
Joined: 7 years ago
Posts: 2
Topic starter  

Hi, first of all many thanks for your website, I've spent the last few days digging around and learning through all your projects. Forgive me if I use the wrong terms below, it's been years since I last coded anything. I 'm finding myself stuck with trying to figure out a particular way to program a set of neopixel strips.

I'm working on a fairly large art project that uses 3 neopixel strips with 456 (4x114) LEDs per strip, each strip is connected to a separate pin on a teensy3.2 and I'm using the adafruit library and the Arduino development environment. These strips are configured to create multiple triangles, however the sides of each triangle are made up sections of each strip. 

So triangle-1:  strip1 with pixels 0-113, strip2 with pixels 114 - 227, strip3 with pixels 342 - 455

Is there a way to address these triangles as one would a singular strip? So in essence I would like to address a singular triangle in the code and treat it as one strip.


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2663
 

Hi Richard,

well, I have to admit that I have never done a project with more than 300 LEDs, but I'd guess you could 1 of 2 things:

1) Make it one long strip connected to one pin only ... I'm not sure if 456 LEDs would be pushing it or not>

To do this connect the Data-out pin from the end of strand 1 to the Data-in pin of the beginning od strand 2, etc.
You might need to feed extra power in between as well, so connect +5 from each strand to the power supply.

This way you can "talk" to the pins in sequence (ie: 0, 1, 2, ... , 454, 455).

2) Make a small function that converts the coordinates to the right strands.
Something like:

void SetMyLED(int i, uint32_t c) {
  if (i<114) {
    strip1.setPixelColor(i, c); 
  }  else if(i<228) {
    strip2.setPixelColor(i, c); 
  }  else {
    strip2.setPixelColor(i, c);
  }
}

So instead of stripx.setPixelColor(lednumber, color) you'd call SetMyLED(lednumber, color).
Might be useful to have a function that updates all strips as well (like strip.show()):

void ShowStrips() {
  strip1.show();
  strip1.show();
  strip1.show();
}

Just an idea though .. depending on speed of Arduino and LEDs and speed requirements, this might work just fine as well.


   
ReplyQuote

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: