Hello Guest it is March 29, 2024, 08:50:32 AM

Author Topic: Lua programming of voltage meter  (Read 5739 times)

0 Members and 1 Guest are viewing this topic.

Re: Lua programming of voltage meter
« Reply #30 on: February 19, 2018, 10:58:19 AM »
So nice to solve this, thanks!

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Lua programming of voltage meter
« Reply #31 on: February 19, 2018, 11:06:45 AM »
 :)
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Lua programming of voltage meter
« Reply #32 on: February 19, 2018, 05:13:56 PM »
Now it is working great with the mc.SignalSetState method per Daz assigning an unused input to the LED such as input63 as he suggested.
For those trying trying to use this, note the change to ISIG_INPUT from OSIG_OUTPUT ( 1=on 0=off)  This code is in my PLC script.
As Daz suggested, I tried but do not have a ~ sign on my keyboard so stuck with >=.1 instead of ~= 0.  It works better because there is noise below .1v

  if tonumber(regval) >.1 then
        mc.mcSignalSetState (mc.mcSignalGetHandle ( inst ,mc.ISIG_INPUT63  ), 1)
    else
        mc.mcSignalSetState (mc.mcSignalGetHandle ( inst,mc.ISIG_INPUT63  ), 0)
    end
    --

I could not get reliable function with the scr.SetProperty method.  Sometimes it would work and sometimes it would switch to off and stay off. 
Re: Lua programming of voltage meter
« Reply #33 on: February 19, 2018, 05:37:43 PM »
As Daz suggested, I tried but do not have a ~ sign on my keyboard so stuck with >=.1 instead of ~= 0.  It works better because there is noise below .1v

If youneed a ~ try the holding the  alt key and then type in 126. Should give you a Tilde(~) once you let go.


Mike
We never have the time or money to do it right the first time, but we somehow manage to do it twice and then spend the money to get it right.
Re: Lua programming of voltage meter
« Reply #34 on: February 19, 2018, 05:40:56 PM »
Thanks Mike but it works! ~~~ but I had to use the num pad.  It does not work using the number keys across the top of the keyboard though.
« Last Edit: February 19, 2018, 05:45:57 PM by thespindoctor »
Re: Lua programming of voltage meter
« Reply #35 on: February 19, 2018, 08:41:43 PM »
Glad it works. IIRC there is a number for every symbol that you would every need.
I always use the number pad.I just tried it the other way and it doesn't work here either.

Mike
We never have the time or money to do it right the first time, but we somehow manage to do it twice and then spend the money to get it right.