Running Light with Neopixel

Hey Guys,
I am still pretty new to Node Red, but I somehow like it already. I am helping a friend a I am now into the controlling of a Neopixel strip. The Basic function, that i wanna realize is, that I have a Timestamp with an interval of 70ms ( it sends every 70 ms a true as payload). Then I want to have a function element which increases everytime a variable by 1. So when I start the variable starts with 0 and sents to Neopixel 0 a color. after 70ms its a 1 and sents to Neopixel 1 a color. and so on until it reaches 6. I have no idea how to realize it in the function block. Hope you can help.

A kind of different question is: A friend of mine has a bigger project and there will be more questions about node red. Shall I open a Topic for the Project and just put all the questions in there? And if we done, I cann put the code in here, maybe it helps someone else?

Thanks anyways.

All the Best

You will need a temporary variable that keeps track of the count. You can do this nicely in a function node by using a context variable.

// Get the counter variable from store or give zero if the variable doesn't yet exist
let counter = context.get('mycounter1') || 0

// Add 1 to the counter

// Write the counter back to the store
context.set('mycounter1', counter)

// output a msg with the new count
msg.payload = counter

return msg

NB: the code above is untested.

You will generally get the best reception by trying things yourselves and then raising specific questions. Long, complex questions get less help because people don't have the time or energy to wade through them as much.

There is a section for sharing your projects which you can use. It is also nice to add them to the Flows site (see the menu at the top of this site). so that people can easily reference them in the future.

Thank you very much for your help. Your Comments are really good.
I am slowly understanding the things. I will try the code and give a feedback than.

Have a wonderful week