desmondli
Hi,

I just started my OpenPLC journey and created my first project using the tutorial and was wondering is It possible to turn on the LED through a packet sent to the default ModBus server port 502 instead of pressing the button physically? I have been going in circles and would be happy to get any help and direction! Thank you in advance!

Setup:
1 X RPI 3 b+
1 X LED
2 X Button
Quote 0 0
thiagoralves
Sure. Just change the location address of the button to any unused output (like %QX2.0 for example), and then use modbus to write to address 16 (modbus 16 = %QX2.0). The correlation table between modbus and OpenPLC addresses can be found here: http://www.openplcproject.com/scada
Quote 0 0
desmondli
Hi Thiago,

Thank you! I really appreciate the response, tested and it is working now. Can I ask how do you calculate that modbus 16 = %QX2.0? Is there a mapping table that I can use? I was enumerating and found that modbus 1 = %QX0.0 as well.
Quote 0 0
thiagoralves
The mapping is sequential. Both addresses start at zero (%QX0.0 and Modbus 0), but OpenPLC address grows in bytes, i.e. QX0.0, QX0.1, QX0.2, ..., QX0.7, QX1.0, QX1.1, ... etc. and modbus address grows linearly (0, 1, 2, ...).
Quote 0 0
desmondli
Thank you Thiago! 
Quote 0 0