node-red-contrib-i2c
node-red-contrib-i2c copied to clipboard
Signed integer only as payload for I²C out node?
I'm using the I²C out node against a PCF8591.
- Address
64
- Command
40
for DAC output - Sent bytes
1
- Values
0
and127
are accepted,
But value 254
is refused with the following error message:
"RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -128 and <= 127. Received 254"
Are signed integers allowed only for the I²C out node?
How to send plain an unsigned integer?
Thank you for your help!
Releases
- I²C node
0.5.5
- Node-RED
1.0.3
As a temporary workaround, I can add an in-between function before the I²C out node.
if (msg.payload > 127)
{
msg.payload = msg.payload - 256;
}
return msg;
The implementation of the I²C out node is not consistent with the I²C in node, which outputs unsigned integers 0..255
.
Is there any expectation of this being fixed? Anytime soon? True there is a work-around, but it should be fixed no?