I am trying to use input from an encoder from one instrument (RMU) to set things on another (TCAS display)
I try to use global variables to do this, but it seems that gloabal variables only are written when they change??
Is this a fact?
I have tried many things but writing for instance encoder clicks are only written when the value change, f.i. when changing direction.
Code: Select all
local TCAS_enc = 1
TCAS_Enc_var = si_variable_create("TCAS ENC", "INT", 0)
function ENC2(direction)
TCAS_enc = direction
si_variable_write(TCAS_Enc_var, TCAS_enc)
if direction == 1 then
-- do stuff
elseif direction == -1 then
-- do stuff
end
end
function TCAS_Range_enc_callback(data1)
print("TCASE enc: ")
print( data1)
end
si_variable_subscribe("TCAS ENC", "INT", TCAS_Range_enc_callback)
hw_dial_add("ARDUINO_UNO_A_D11", "ARDUINO_UNO_A_D12", ENC2)