Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[*.d] | ||
dfmt_align_switch_statements = true | ||
# allman, otbs, or stroustrup | ||
dfmt_brace_style = otbs | ||
#dfmt_brace_style = stroustrup | ||
dfmt_outdent_attributes = true | ||
dfmt_outdent_labels = true | ||
dfmt_soft_max_line_length = 80 | ||
dfmt_space_after_cast = false | ||
dfmt_space_after_keywords = true | ||
dfmt_split_operator_at_line_end = false | ||
|
||
trim_trailing_whitespace = true | ||
end_of_line = lf | ||
indent_size = 3 | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = 120 | ||
tab_width = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name "timer" | ||
description "Simple timer example" | ||
authors "Orfeo Da Viá" | ||
copyright "Copyright © 2017, o3o" | ||
license "LGPL v3.0.0" | ||
dependency "dinodave" path="../../" | ||
|
||
targetType "executable" | ||
targetPath "bin" | ||
libs "nodave" platform="posix" | ||
sourceFiles "../../lib/libnodave.lib" platform="windows-x86_32-dmd" | ||
copyFiles "../../lib/libnodave.dll" platform="windows-x86_32-dmd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import std.stdio; | ||
import std.conv; | ||
|
||
import dinodave; | ||
|
||
void main(string[] args) { | ||
enum string IP = "192.168.0.150"; | ||
string ip = IP; | ||
if (args.length > 1) { | ||
ip = args[1]; | ||
} | ||
|
||
writeln("Use ip ", ip); | ||
writeln("\nTrying to read 4 items from Timers (supposed to work S7-3xx/4xx)\n"); | ||
auto dc = createConnection(ip); | ||
// read 4 timers: each timer has 2 bytes | ||
const(int) res = daveReadBytes(dc, daveTimer, 0, 0, 4, null); | ||
|
||
writefln("function result:%d=%s\n", res, daveStrerror(res)); | ||
|
||
if (res == 0) { | ||
writeln("\nShowing the results using daveGetSeconds(dc)\n"); | ||
writefln("Time: %0.3f, ", daveGetSeconds(dc)); | ||
writefln("%0.3f, ", daveGetSeconds(dc)); | ||
writefln("%0.3f, ", daveGetSeconds(dc)); | ||
writefln(" %0.3f\n", daveGetSeconds(dc)); | ||
|
||
writeln("\nShowing the same results using daveGetSecondsAt(dc,position)\n"); | ||
writefln("Time: %0.3f, ", daveGetSecondsAt(dc, 0)); | ||
writefln("%0.3f, ", daveGetSecondsAt(dc, 2)); | ||
writefln("%0.3f, ", daveGetSecondsAt(dc, 4)); | ||
writefln(" %0.3f\n", daveGetSecondsAt(dc, 6)); | ||
} | ||
} |