A simple D binding to LIBNODAVE, a free library to communicate to Siemens S7 PLCs
Note that project's development happens on the GitLab. GitHub repository is a mirror, it might not always be up-to-date.
With dub:
$ dub build
with make (linux):
$ make
(win32)
$ make -f makefile.win32
On Win32 see also wiki.
With dub:
$ dub test
with make (only for linux):
$ make test
import std.stdio;
import dinodave;
void main(string[] args) {
enum string IP = "192.168.221.102";
enum DB = 11;
try {
auto s7 = new IsoTcp(IP);
s7.openConnection(0);
scope(exit) s7.closeConnection();
int start = 160;
int length = 2;
s7.readBytes(DB, start, length);
int a = s7.getU16();
writeln("db11.160: ", a);
} catch(Exception e) {
writeln(e);
}
}
See also directory examples/
and wiki.
$ git clone git@github.com:netdata/libnodave.git
$ cd libnodave
$ make
$ sudo make install
or use install-libnodave.sh