Hi mates, I would use a node that works good, but unfortunately the author decided to output an object which I can't easly address in NR, this is the picture:
I can't type in a function:
var ADC0 = msg.payload./dev/i2c-1.ads1115.0x4A.singleEnded.channel_0.miliVolts;
How can I get that value? Thank you
This should work
let ADC0 = msg.payload["/dev/i2c-1"].ads1115["0x4A"].singleEnded.channel_0.miliVolts;
Though I note that it is 0x48 in the debug.
The node red docs page Working with Messages shows you how you can easily copy the path to a property from the debug pane, so avoiding this sort of problem.
Thank you, didn't know, I'll remember about it!
Why you used let instead of var?
It is a matter of scoping. In this case it won't make any difference, but nowadays there is no reason to ever use
var as far as I am aware. One should use the more modern
const. If you only set the value of the variable once then it should be
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.