18.10.2017, 07:54
(This post was last modified: 18.10.2017, 08:15 by Erwin van der Zwart.)
Hi,
That depends on what you want to do, what information do you need from the 2 byte value to the 1 byte value?
Could be something like this:
Or:
BR,
Erwin
That depends on what you want to do, what information do you need from the 2 byte value to the 1 byte value?
Could be something like this:
Code:
twobytevalue = event.getvalue()
onebytevalue = math.floor((twobytevalue / 256) + 0.5)
grp.write('1/1/2', onebytevalue)
Code:
twobytevalue = event.getvalue()
if twobytevalue < 255 then
onebytevalue = math.floor(twobytevalue + 0.5) -- round airflow to integer
else
onebytevalue = 255 -- if airflow is higher then 255 then max is reached
end
grp.write('1/1/2', onebytevalue)
Erwin