Hello
Guest
it is
May 23, 2025, 03:35:38 PM
Guest
Login
Register
Menu
Home
Help
Search
Login
Register
YouTube
Machsupport Forum
/
Mach Discussion
/
Mach4 General Discussion
/
code problem
« previous
next »
Print
Pages:
1
Go Down
Author
Topic: code problem (Read 3882 times)
0 Members and 1 Guest are viewing this topic.
Bill_O
598
code problem
«
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.
Logged
RBeaubien
77
Re: code problem
«
Reply #1 on:
February 26, 2019, 11:22:35 AM »
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))
Logged
- Robert Beaubien
- Drone Plastics
-
“Dear Algebra, Please stop asking us to find your X. She's never coming back and don't ask Y.”
Bill_O
598
Re: code problem
«
Reply #2 on:
February 26, 2019, 12:21:17 PM »
Robert,
Thanks. I will give it a try.
Bill
Logged
Bill_O
598
Re: code problem
«
Reply #3 on:
February 26, 2019, 03:18:39 PM »
When I run this code it crashes Mach4.
Logged
jbuehn
101
Re: code problem
«
Reply #4 on:
February 26, 2019, 03:48:55 PM »
mc.mcRegGetValue only uses a single parameter...hreg
«
Last Edit: February 26, 2019, 03:55:19 PM by jbuehn
»
Logged
Bill_O
598
Re: code problem
«
Reply #5 on:
February 26, 2019, 04:12:17 PM »
jbuehn,
Works perfect now.
Thanks,
Bill
Logged
Print
Pages:
1
Go Up
« previous
next »