Third party software and hardware support forums. > Modbus

Arduino and Modbus Help

(1/1)

Aral:
Hi

I am totally new to Mach4 and I am struggling with Lua. I connected a Arduino Uno through the Modbus to Mach4. The communication between the Arduino and Mach is ok. On the A0 analog pin is a LM35 Temp sensor. I want to show the temp reading in a text box. In the PLC script I Put the following lines:

-- Temp LM35
inst = mc.mcGetInstance()
hreg = mc.mcRegGetHandle (inst,"Arduino/LM35")
local TempVar = mc.mcRegGetValueString(hreg)
local TempValue = tonumber(TempVar)*500/1023

How do I get the Tempvalue in the textbox register?

Sorry if it is a dumb question.

Thanks

Johan

Navigation

[0] Message Index

Go to full version