Skip to content

Commit

Permalink
added a demo for the features introduced in the last commit, using an…
Browse files Browse the repository at this point in the history
… OPC access component
  • Loading branch information
unknown authored and unknown committed Dec 10, 2009
1 parent 20f3f64 commit 91fc072
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions demo/opcdata/opc.lua
@@ -0,0 +1,23 @@

require "luacom"

opc = luacom.CreateObject("OPCDataCtrl.OPCDataCtrl.1")
assert(opc)

opc:setOPCServer("Matrikon.OPC.Simulation.1")

print(opc.OPCServer)
assert(opc:Connect())

print(opc:ReadVariable("Random.Int2"))
print(opc:ReadVariable("Random.Int2"))
print(opc:ReadVariable("Random.Int2"))
code, t1, t2 = opc:ReadMultiVariables({ Type = "array of string", Value = { "Random.Int2", "Square Waves.Real8" } })
print(code)
for k, v in pairs(t1) do
print(k, v)
end
for k, v in pairs(t2) do
print(k, v)
end

1 comment on commit 91fc072

@hz658832
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,
I have a Problem with Luacom for OPC, can you please help me?
Can you tell me, how can I get your Code worked, I have installed the luacom using all methods, but i got always the error when i created "CreateObject("OPCDataCtrl.OPCDataCtrl.1") ".

Thank you very much!

HM

Please sign in to comment.