st-one-io / node-red-contrib-s7

A Node-RED node to interact with Siemens S7 PLCs
GNU General Public License v3.0
108 stars 55 forks source link

How to write a dint array to a PLC? #111

Closed StefWe closed 1 year ago

StefWe commented 1 year ago

After successfully reading an array of 2 dint from S7 PLC, e.g. DB550,DI1234.2, I also wanted to write a dint array back from NodeRed. Unfortunately, I was not successful so far. I have the following flow settings

to read: image

to write: image

flow: image

i get the following error: image

How to define the write endpoint correctly? In the description is written that payload and variable has to be defined as array, but how?

StefWe commented 1 year ago

My solution now is to put a function between the two nodes. image

Inside the function we copy the payload array.

msg.payload = [msg.payload];