Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: Bill_O on February 26, 2019, 10:32:45 AM
-
The attached code is giving me a nil value on the first line.
What do I have wrong.
-
You didn't declare inst. Try this:
local inst = mc.mcGetInstance()
local hreg=mc.mcRegGetHandle(inst, 'ESS/Encoder_0')
local EncRawVal=mc.mcRegGetValue(inst, hreg)
scr.SetProperty('droEncRep2', 'Value', tostring(EncRawVal))
-
Robert,
Thanks. I will give it a try.
Bill
-
When I run this code it crashes Mach4.
-
mc.mcRegGetValue only uses a single parameter...hreg
-
jbuehn,
Works perfect now.
Thanks,
Bill