# Coding Advice - Examples Please!

**URL:** <https://forum.xod.io/t/coding-advice-examples-please/29>\
**Category:** Uncategorized\
**Created:** [June 29, 2017, 7:36pm UTC](https://forum.xod.io/t/coding-advice-examples-please/29 "2017-06-29T19:36:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abefm](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@abefm](https://forum.xod.io/u/abefm)\
**Post date:** [June 29, 2017, 7:36pm UTC](https://forum.xod.io/t/coding-advice-examples-please/29/1 "2017-06-29T19:36:34Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [June 30, 2017, 9:07am UTC](https://forum.xod.io/t/coding-advice-examples-please/29/2 "2017-06-30T09:07:33Z")

</div>

Hello!

It could be done with something like:

 ![](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/7f3dd4cb9c7cf824bbba9b0a7812d47f9ba80212.png)

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:

 ![](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/73fd3b83b190d8184b36ded273804031235cd348.png)

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

 ![](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/6c15d81c7465ecd88884557a8cc02a45bd6d4425.png)

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

---

<div class="post-metadata">

**Author:** ![abefm](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@abefm](https://forum.xod.io/u/abefm)\
**Post date:** [June 30, 2017, 5:18pm UTC](https://forum.xod.io/t/coding-advice-examples-please/29/3 "2017-06-30T17:18:32Z")

</div>

Thanks for the timely response! It’s informative.
