Notifications
Clear all

Theatre chase in opposite directions.

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

@will 

Second one appears slower too, although delay is same as first.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 
Posted by: @davy-ps FYI @robotBuilder

@will 

Part 2 What I think is happening is that colourList and colourList 2 are running simultaneously instead of two separate functions. You can see in video that the LED direction is same as first code, but there are extra colours.

[video snippet]

What do you think? 

I don't know what you think is wrong, it's doing exactly what you told it to do.

For each row of the matrix:

- it first sets in the colours from colour list 1

- then displays

- pauses for 100 ms

- then it sets the colours from colour list 2 for the same matrix row,

- displays that

- pauses for another 100 ms

and then moves onto the next matrix row.

 

What did you expect/want it to do ?

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


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

@will 

Hi Will,

          Wanted to see this .....

then this.

Cheers ,

Davy.

 

 

 


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

@davy-ps 

Let us start again?

Don't bother with trying to untangle the code I sent we can start again in hopefully easier steps.

I have installed the fastLED library so I can now compile the code.

Maybe I will order some RGB LEDS so I can wire them up the way you have done and test run the code.

So we want to turn of a row of RGB LEDS.

Here is a sample set of CRGB colors we might use.

CRGB( 0, 0, 0) // BLACK
CRGB(255,255,255) // WHITE
CRGB(255, 0, 0) // RED
CRGB( 0,255, 0) // LIME
CRGB( 0, 0,255) // BLUE
CRGB(255,255, 0) // YELLOW
CRGB( 0,255,255) // CYAN
CRGB(255, 0,255) // MAGENTA
CRGB(192,192,192) // SILVER
CRGB(128,128,128) // GRAY
CRGB(128, 0, 0) // MAROON
CRGB(128,128, 0) // OLIVE
CRGB( 0,128, 0) // GREEN
CRGB(128, 0,128) // PURPLE
CRGB( 0,128,128) // TEAL
CRGB( 0, 0,128) // NAVY

To turn on a row of 10 LEDS using fastLED we must place the CRGB colour for each led in the CRGB leds[] list and then call fastLED.show() to show the colors in the leds[] list.

leds[0] = CRGB(255, 0, 0) // RED
leds[1] = CRGB(128, 0,128) // PURPLE
leds[2] = CRGB( 0, 0,255) // BLUE
...
leds[9] = CRGB(255,255, 0) // YELLOW

fastLED.show() // show leds with colors in leds list

Now if that much is clear I will continue later with actual code using a for loop which you now feel you understand.

 


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

@robotbuilder 

Just a quick one. How do we open Fastled Library to view all content? I can only access examples through Arduino.

Cheers,

Davy.


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

@robotbuilder 

 Yup. Your explanation of CRGB colour ratios is clear, and the concept of the LED list makes sense.

 What does the "C" in CRGB stand for?

 

Cheers,

Davy.


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

@davy-ps 

I don't know how you view the library code. All I can do is look at the example code for using its methods. It all has to do with object orientated programming (OOP). Too complex to explain in a post (or many posts).

https://fastled.io/

What does the "C" in CRGB stand for?

Maybe Color. Too complex to explain what CRGB is without a full course in programming c++.  It doesn't mean you can't use it by following the examples.

I thought this was a nice little introduction to fastLED.

 


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

@robotbuilder 

Roger Wilco.

 

👍 👍 👍 


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1037
 

@davy-ps 

This is meant to be a humorous comment, so please take it that way!

Do you, @robotbuilder, and @will spend 24 hours a day tackling these RGB LEDS?

The majority of the posts on the forum lately have been around this subject.  Maybe everyone has become hooked on the subject, as I have, and can't wait for the next round of posts.  In fact I have ordered a RGB spooled strip from Amazon which is scheduled for delivery today.  No doubt you guys are driving the sales of these strips way up! 🤣 

SteveG


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 
Posted by: @davy-ps

@robotbuilder 

Just a quick one. How do we open Fastled Library to view all content? I can only access examples through Arduino.

the libraries for the Arduino are stored under your "home directory" in whatever OS you use. I'm on a Mac, so mine is at

~/Documents/Arduino/libraries/FastLED/<component>

Note that you can read the contents (or could if you were familiar with C++) but you must NEVER CHANGE THE FILES THEREIN !

At this stage, I think that examining a C++ class source will be more confusing than helpful. It helps to understand C before C++ makes much sense.

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


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 
Posted by: @davy-ps

@will 

Hi Will,

          Wanted to see this .....

then this.

Cheers ,

Davy.

Well, think about that. To get that effect you have to run the for loop for every row of the matrix and set the colours by column from colourList.

Then, when that's complete, you have to run the same thing again but using the colours from colourList2.

That's exactly what you show in your home movies, first using one set and then another.

So reset your first loop over the matrix rows to just use colourList, copy the whole thing (i.e. both of the loops for i and j, rows and columns) and paste that under the first loop. Then change the second loop t use colourList.

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


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 
Posted by: @codecage

@davy-ps 

Do you, @robotbuilder, and @will spend 24 hours a day tackling these RGB LEDS?

Doesn't everybody ?

The majority of the posts on the forum lately have been around this subject.  Maybe everyone has become hooked on the subject, as I have, and can't wait for the next round of posts.  In fact I have ordered a RGB spooled strip from Amazon which is scheduled for delivery today.  No doubt you guys are driving the sales of these strips way up! 🤣 

They're a huge lot of fun and they're so much more versatile and easy to deal with than LEDs 🙂

I feel that I should apologize to the forum though because I don't really think that this is a proper environment for learning to code, just solving individual problems when they come up.

In my opinion, there are many YouTube videos and other sites that are better suited for the task of education.

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


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

@codecage 

The problem was trying to explain how a program worked to someone who hadn't learnt how to program. So both had to be explained at the same time. If you want to make your own light displays you have to learn how to program first.

 


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

@will 

I feel that I should apologize to the forum though because I don't really think that this is a proper environment for learning to code, just solving individual problems when they come up.

In my opinion, there are many YouTube videos and other sites that are better suited for the task of education.

I fell into the "teacher mode" without fully realising how hard it was. The same issue exists for electronic projects when someone doesn't understand basic electronic concepts.

Still tinkering is fun way to start and get motivated to explore deeper as @davy-ps did when directed to mcwhorter's tutorials to learn about for loops. With Arduino electronic projects others might be motivated to better understand the basic electronic concepts involved.

Usually I don't have the hardware involved in a question and thus can't really provide a useful reply.

 


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

   
ReplyQuote
Page 8 / 11