Skip to content

Instantly share code, notes, and snippets.

View milgner's full-sized avatar
🖖
Greetings, fellow traveler of the universe!

Marcus Ilgner milgner

🖖
Greetings, fellow traveler of the universe!
View GitHub Profile
@milgner
milgner / ReadModbusPal.kt
Last active February 17, 2022 10:26
PLC4X Kotlin
fun main() {
PlcDriverManager().getConnection("modbus://localhost:5002").use { conn ->
if (!conn.metadata.canRead()) {
println("Cannot read!!")
return
}
val builder = conn.readRequestBuilder()
builder.addItem("value-1", "coil:1")
builder.addItem("value-2", "coil:3[4]")