Task #1 - Welcome Random Strangers!

Sounds good to me! As for SeaLaVie… soon as the V3 Arrives.

Question for now, are there any specs on the LED strand? Or, is randomness better? :grin:

For this task, any strand will do.

In the longer term, I’m recommending everyone have at least an 8x8 square matrix. @wizard sells a nice one at his Tindie store (and I believe at Crowd Supply too), but any matrix of decent size will do.

I’ve got a few smaller ones including one from Ben, but I’m enjoying using a 16x16 one that’s EcoWS2812 very thin panel ($24 at Amazon, BTF is one source but there are others) and I’ve tucked it into an 8 inch square painting canvas, which is fits into nicely and that diffuses it just a bit. I can still see the dots but the white canvas spreads out enough light to make it pretty. Photos soon. The more solid matrixes are hard to do that with, (fitting the panel next to the canvas, due to wood frame)

I expect we’ll have people drifting in as the V3s arrive, and we need to do some promotion too, but I figure the first few weeks will be 1 dimensional, so likely Matrixes in March.

That’ll give us 4 weeks of February, and if V3s only arrive half way thru, people can easily catch up on a few tasks we’ll have begun.

2 Likes

I’m in! I will be using my V2 with a 60 led strand until my V3 with sensor board comes… then my daughter may get my V2 :slight_smile: I’m hoping to get her interesting in art/programming.

2 Likes

On how to approach this sort of thing: The art of making software is less about coding, and more about looking at a problem and breaking it down into smaller problems that you can solve elegantly.

In this case, we want to light a random pixel for some period of time – certainly for more than one frame. This means, to start with, we need a random number!

The random() function is a great way to get a random pixel index to use. But since random() returns a different random number every time, we can’t just call it on every frame. That’ll just flash different random pixels and look like static. We need a way to generate a number and save it for a while.

There are (at least) two general ways to do this. The usual method involves storing the values we want and retrieving them at render time. If you want to light more than a single pixel though, the amount of storage required goes up. Enough pixels and you’ll wind up out of memory.

The alternative requires the storage of only a single value, no matter how many pixels you may eventually want to light. (Hint: This technique is used by games with “procedural worlds”, and also usually involves a bit of xor, which should make the xorcerers happy. ) Big props if you can solve it this way!

2 Likes

Thank you, that’s exactly the sort of discussion I was figuring we’d have: how to approach the task, so people see how to break it down and figure out the pieces.

1 Like

What does time() do? I see it in some examples in the BeforeRender like
t = time(0.5)

at first I thought it was like a delay but that doesn’t make sense and the PB docs don’t mention it or I am just missing it.

I found some info here Slow Down Render

You missed it. It’s on the page under…

Waveform Functions

time(interval)

A sawtooth waveform between 0.0 and 1.0 that loops about every 65.536*interval seconds. e.g. use .015 for an approximately 1 second.

It’s not a delay, it’s a slant up straight down wave “sawtooth” means it’s:
/|/|/|

And if you put 1 as the interval, it’ll take 65.536 seconds to do one climb from zero, hit 1, and drop straight back to zero, and start over.

1 Like

For those wondering about when beforeRender gets called… beforeRender(delta) Question explains… if you have 3 pixels…

the order is beforeRender(delta), render[0], render[1], render[2] and then repeat for infinity. The delta in the beforeRender(delta) is the amount of time since the last beforeRender was called.

I’d describe it:

BeforeRender is called
Then Render (or Render2D or Render3D if they exist) is called, which loops thru all of the Pixels 0…pixelcount-1 (so X pixels, it goes thru 0,1,…X-1)
Then Start over… So beforeRender, Render, and again.

These two are basically the 2-stroke engine of patterns. (I’ll come back to this analogy in the future)
Prime the pump with BeforeRender, set your variables that any given “frame” of animation will consist of… Then render the frame, going thru each pixel, which may and likely will require computations, some of which are personal to that pixel (# in pixel count, aka index) and Mapping (pixels location in 2D or 3D space, usually but not always, the map could be anything, we’ll eventually come back to this, months from now… ). This pushes the pixels out the door, and then you start over.

So in context of the current Task:

Decide which pixel should light, how long, if it’s twinkling, etc… These need to be random, right?
Pumping the pump: BeforeRender

Then we display this info (Render),

and go back (BeforeRender) and see if we’re done, and if so, pick new random things and start over.

Make sure to comment your code generously :slight_smile:

I’m in :wink: I fully expect ZRanger1 to utilize the center column of rule 30.

Do we have a function that gives a random value between min and max ? I see that random(x) is between 0 and x… I was thinking about using clamp around that but that would not be random it would be mostly min or max…

@jeff – pretty much that! My first real computer language was APL. It warped my brain for life…

I feel like I am burning the cobwebs out of my brain… what is that burning smell!? :smiley:

If random(X) does 0…X, then random(max-min)+min will do that.

2 Likes

Is there an “acceptable” way to make a delay? Since we are only outputting one pixel I think mine looks like noise because it is going to fast. Though shrinking the fading speed is not helping. So it’s possible I have other issues :slight_smile:

Another question. How are we to get help when we don’t know what is wrong? It would be cool if someone could look at our “attempt” and tell you what is wrong without telling you the solution to the assignment. Does that make any sense? I am getting an “execution steps exhausted”… I think my PB is tired of weak programming :slight_smile:

Does random(max-min)+min work for values of max and min that are less than 1?

I figure that people can post partial solutions if they get stuck… It’ll help everyone to see where folks get stuck.

IMO, posting a litte code and asking for help is great! The object here is for everybody to get better. For folks a little further along the path, having to come up with good, simple explanations for why “this” and not “that” helps them improve their skills and understanding too.

I consider myself a relatively awful teacher – @jeff and @scruffynerf, among others, are much better – but still, most of my IRL work lately involves designing things, then explaining them to people at sometimes vastly different levels of technical knowledge. It’s a skill well worth practicing.