Dear Jbudd, definitely this last one is exactly what I was trying to achieve, thank you so much.
Thanks all for the availability, help and patience you had with me, really much appreciated.
I am not familiar with serial input but I presume it's a more or less continuous stream of data.
The approach I used above will emit a message whenever it gets all three inputs but it does not make sure they all come from the same instant of reading.
You might want to specify a timeout in the Join node.
And/or if the three readings always arrive in the same order, say SOC; I; V, change the function to set msg.complete = true in the V case statement.
You are right, it is a continuos stream of data coming with updated values.
I am perfectly fine with the way the join node works, it doesn't matter if the values come from the same instant or not because they are continuously updated.
Thank you once more.
Thanks for the clarification.
I now understand better.
My basic programming nodered function programming began one year ago wil nodered 1.2.6.
Recently, I migrated all my flows to version 3.
I probably used var most of time for declare variable. Should I change them to let / const ? Following which rule?
Perhaps this discussion on function node declare should be moved to a special thread.
Pierre RUWET
Happy that your problem was solved. Thanks Jbud!
Depending of what you do with the results, if the data are continuously refreshed, I would suggest to sample them at lower rate or detect change using filter RBE node
Pierre RUWET
Don't worry about changing existing code, unless you are working in that function anyway. Usually it doesn't make any difference. The basic rule is use const
when the value is constant (so is not changed after you define it). It doesn't have to be the same every time through the function, just that it doesn't change in that invocation. So you might do
const x = msg.payload.x
then provided you don't try to set the value of x anywhere else in the function it will be ok. The editor will tell you if you try to write to it later. It is worth doing as it allows the interpreter to make use of the fact that it does not change and can sometimes generate more efficient code. For non-constants let
.
Nice suggestion piwi447, i will look into it.
Actually just an update every second is more than enough for me.
Thank you mate!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.