Hi Keith,
Thanks for the quick reply - I'll have a look at that.
The Dataref Tool simply shows " " as the value, hence my assumption it's a string.
Out of curiosity i tried all the other data types and "BYTE" produced what looked suspicously like an ASCII code.
My code now loos lke this - gone off on a bit of a tangent, but it seems to work! There will doubless be a better and more efficient way of doing it...
Code: Select all
V1_image = img_add("V1_bug.png",0, 0, 600, 600)
VR_image = img_add("VR_bug.png",0, 0, 600, 600)
V2_image = img_add("V2_bug.png",0, 0, 600, 600)
function one_R_callback(value)
hundreds = (value[8] - 48) * 100
tens = (value[9] - 48) * 10
units = value[10] - 48
V1 = hundreds + tens + units
V1_angle = ((V1 - 58)/280) * 360
rotate(V1_image, V1_angle )
print("V1 is " .. V1)
end
function two_R_callback(value)
hundreds = (value[8] - 48) * 100
tens = (value[9] - 48) * 10
units = value[10] - 48
VR = hundreds + tens + units
VR_angle = ((VR - 58)/280) * 360
rotate(VR_image, VR_angle )
print("VR is " .. VR)
end
function three_R_callback(value)
hundreds = (value[8] - 48) * 100
tens = (value[9] - 48) * 10
units = value[10] - 48
V2 = hundreds + tens + units
V2_angle = ((V2 - 58)/280) * 360
rotate(V2_image, V2_angle )
print("V2 is " .. V2)
end
xpl_dataref_subscribe("ixeg/733/FMC/cdu1D_line1R_d", "BYTE[10]", one_R_callback)
xpl_dataref_subscribe("ixeg/733/FMC/cdu1D_line2R_d", "BYTE[10]", two_R_callback)
xpl_dataref_subscribe("ixeg/733/FMC/cdu1D_line3R_d", "BYTE[10]", three_R_callback)