Notifications
Clear all

Theatre chase in opposite directions.

155 Posts
6 Users
2 Likes
11.3 K Views
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

@will 

Thanks .

This works too. Now that I'm looking at things differently.

 

Last input of pattern. Blacked LED 1 and 8.

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

 


   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

HAHA I just twigged this is what you told me in the first place!!!!!!!!!!!

@will 

Thanks .

This works too. Now that I'm looking at things differently.

 

Last input of pattern. Blacked LED 1 and 8.

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

@robotbuilder 

Thanks Mate. I will have a play around with it.  I will post a video of your modified code in action. I think it looks good and more importantly I understand why things are happening.

 

PS

I spotted your deliberate mistake in last code.

😉

 

Cheers,

Davy.


   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2507
 

@davy-ps 

What is the purpose of the final empty for loop (for j=0 to 9) ?

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@davy-ps 

How are your leds wired up you don't seem to be using an rgb led strip?

You seem to be getting the idea with the for loops. The FastLED library has a lot more to offer and probably worth your while looking at some examples of its use online.

 


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

@will 

What is the purpose of the final empty for loop (for j=0 to 9) ?

Slackness on my part. Would have had another loop there as I was experimenting and didn't remove complete loop instruction during edit.

😉


   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

@robotbuilder

How are your leds wired up you don't seem to be using an rgb led strip?

 

NeoPixel connection

Green is data IN from Arduino via 330 Ohm resistor, which is then piggy backed to following LED and so on. Final pin on final LED is left as is.

There is also a 100 uF capacitor across  + and -.

Using individual addressable LEDs.

Cheers,

Davy.

 


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@davy-ps 

Missed that one!  I didn't know you could buy individual addressable rgb leds or that Bill had covered the topic.  Making colour led displays just wasn't on my radar.

 


   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

@robotbuilder 

 

Neopixel demonstration starts around 25-00


   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

   
ReplyQuote
Davy PS
(@davy-ps)
Member
Joined: 2 years ago
Posts: 74
Topic starter  

@robotbuilder 

Mate, further to my previous post....

With your last example you a mixing methods (look up table for values to use vs algorithm to generate those values). I would recommend that you learn to use algorithms. Lists and tables have a use but they aren't teaching you how to improve your programming.

For example if you want two different colours to pass each other you might think how to compute the second led position from the position of the led moving right.

ledNumber1: 0 1 2 3 4 5 6 7 8 9
ledNumber2: 9 8 7 6 5 4 3 2 1 0

Notice that ledNumber2 = 9 - ledNumber1

In this example the red moves left to right while the green moves right to left. This is repeated.

So the bouncing effect IE when one colour starts at 0 to 4 and second colour starts from 9 to 5 would look like this?

ledNumber1: 0 1 2 3 4 4 3 2 1 0
ledNumber2: 9 8 7 6 5 5 6 7 8 9

If so, how is this applied?

Thanks,

Davy.

 


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

   
ReplyQuote
Page 10 / 11