Coding Advice - Examples Please!

Hey! As I’m plenty new to this, and I’m sure others will have similar questions, I thought a thread on how to write certain bits of code would be helpful.

Taking the blink example, in the second stage where you add an additional light - I would like to have the second light flash, say, 3 times quickly (3 hz) and then stop until the next toggle of the slow light (0.5 hz).

I think what I’m missing is a variable - i.e. for each pulse of fast light, I increment a variable, and when that variable is greater than a constant (3) I don’t flash. Then I reset everything on the fast-light chain whenever the slow-light chain turns on.

Is that a bad approach? How would I implement it? I have a sense it uses input- and output numbers, but I don’t yet see how.

Thanks!

1 Like

Hello!

It could be done with something like:

Yes, there is a counter node that is not in the standard library although it is a good candidate for it. Meanwhile I could implement it in XOD:

What is select? Another good candidate for stdlib. Meanwhile:

Uploading… :dizzy_face: crash. Some odd error appeared that shouldn’t be here. Let it be another bug to hunt for today. Thank you.

Thanks for the timely response! It’s informative.