Hello Guest it is October 16, 2019, 04:36:35 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Aral

Pages: 1
Modbus / Arduino and Modbus Help
« on: August 19, 2019, 05:46:20 AM »

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.



Pages: 1