<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									LEDs: How to change the order of the LEDs - Arduino				            </title>
            <link>https://www.tweaking4all.com/forum/arduino/leds-how-to-change-the-order-of-the-leds/</link>
            <description>Tweaking4All.com Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Sat, 09 May 2026 19:23:41 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: LEDs: How to change the order of the LEDs</title>
                        <link>https://www.tweaking4all.com/forum/arduino/leds-how-to-change-the-order-of-the-leds/#post-3480</link>
                        <pubDate>Mon, 17 May 2021 10:04:48 +0000</pubDate>
                        <description><![CDATA[I think there are 2 possible methods you can apply to accomplish this;
Option 1 -- Use math
Now this trick only works when there is a certain logic to determine the correct position.For ex...]]></description>
                        <content:encoded><![CDATA[<p>I think there are 2 possible methods you can apply to accomplish this;</p>
<p><strong>Option 1 -- Use math</strong></p>
<p>Now this trick only works when there is a certain logic to determine the correct position.<br />For example, when the LEDs are placed in a matrix. In that case you can calculate the actual position based on column and row.</p>
<p>In your example, I do not recognize a pattern, so this may not apply for that situation.</p>
<p><strong>Option2 -- Make a translation matrix</strong></p>
<p>Using FastLED we define an array for the LEDs, where the index is the <em>n</em>-th LED on the strip (eg. <span>Led array =&gt; 1,2,3,4,5,6…49,50).<br /></span></p>
<pre contenteditable="false">CRGB leds;</pre>
<p> </p>
<p>The translation array basically is an array of integers (see also <a href="https://www.tweaking4all.com/hardware/arduino/arduino-programming-course/arduino-programming-part-8/" target="true">my article on Arrays in the Arduino course</a>).</p>
<pre contenteditable="false">int translate;</pre>
<p>This array we need to populate with the order they are actually in, eg:</p>
<pre contenteditable="false">in translate { 5,37,2,34…21,1 }; // fill in the missing numbers of course</pre>
<p> </p>
<p>Now, normally we'd set a LED color based in the index, which now needs to be translated.</p>
<p>Original call:</p>
<pre contenteditable="false">leds = CRGB::Red;</pre>
<p>Call with translation:</p>
<pre contenteditable="false">leds[ translate ] = CRGB::Red;</pre>
<p> </p>
<p>So as an illustration: we want the <strong>4</strong>th LED (4) to be set to Red. However the 4th LED is actually #<strong>34</strong>. (from <span>Led array =&gt; 5,37,2,34…21,1)</span><br />Here: "<strong>translate</strong>" will actually return <strong>34</strong>, which we use as the index for the actual "<strong>leds</strong>" and the correct LED will be called.</p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/leds-how-to-change-the-order-of-the-leds/#post-3480</guid>
                    </item>
				                    <item>
                        <title>LEDs: How to change the order of the LEDs</title>
                        <link>https://www.tweaking4all.com/forum/arduino/leds-how-to-change-the-order-of-the-leds/#post-3479</link>
                        <pubDate>Mon, 17 May 2021 09:53:52 +0000</pubDate>
                        <description><![CDATA[A question posted by Khammel under the LED Effects article:
How do you re-order the initial array or string of led’s before it is passed to rest of program?
Typical program asks number of ...]]></description>
                        <content:encoded><![CDATA[<p><a href="https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/#comment-545991" target="true">A question posted by Khammel under the LED Effects article</a>:</p>
<p>How do you re-order the initial array or string of led’s before it is passed to rest of program?</p>
<p>Typical program asks number of leds and then labels initial string ordered range</p>
<p>Led array =&gt; 1,2,3,4,5,6…49,50</p>
<p>But what if I want a different led order because it’s a 3D non linear shape, and want my string ordered</p>
<p>Led array =&gt; 5,37,2,34…21,1</p>
<p>What’s the syntax or coding that allows me to put the led strip in any order I like before passing to automated programs? I feel like I should be able to use some sort of cross list or cross mapping?</p>
<p>Using FastLED, or WS2812fx library </p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/leds-how-to-change-the-order-of-the-leds/#post-3479</guid>
                    </item>
							        </channel>
        </rss>
		