This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

storage
#1
backuplist = { '6/0/33', '6/0/38' }
-- save current values
values = {}
for _, addr in ipairs(backuplist) do
  values[ addr ] = grp.getvalue(addr)
end


night = grp.getvalue('1/7/1')
value = event.getvalue()
if value and night  then
  grp.write('6/0/33',true)
  grp.write('6/0/38',true) 
  os.sleep(150)

end


-- restore values
for addr, value in pairs(values) do
  grp.write(addr, value)
end

Good morning,

in above code i would like to do logging the values of 6/0/33 and 6/0/38, and i want to write in the previous group addresses, namely 6/0/32 and 6/0/37.
How can i do these?

Best Regards,
Chris Balatis
Reply
#2
(02.12.2022, 06:42)balatis Wrote: backuplist = { '6/0/33', '6/0/38' }
-- save current values
values = {}
for _, addr in ipairs(backuplist) do
  values[ addr ] = grp.getvalue(addr)
end


night = grp.getvalue('1/7/1')
value = event.getvalue()
if value and night  then
  grp.write('6/0/33',true)
  grp.write('6/0/38',true) 
  os.sleep(150)

end


-- restore values
for addr, value in pairs(values) do
  grp.write(addr, value)
end

Good morning,

in above code i would like to do logging the values of 6/0/33 and 6/0/38, and i want to write in the previous group addresses, namely 6/0/32 and 6/0/37.
How can i do these?

Best Regards,
Chris Balatis



---------------------------------


use event.dstraw to get a number

for example:

data1=333
data1=666

dirnum = event.dstraw

 

dir_1 = dirnum + 1 -- or any offset positive or negative
dir_2 = dirnum + 2

grp.write(dir_1 , data1)
grp.write(dir_2 , data2)
Reply
#3
See this: https://forum.logicmachine.net/showthread.php?tid=2278
Reply


Forum Jump: