v0.2.0
modbus
Simple Modbus client library for dart. Currently only the TCP connection is supported.
36Likes 87830-day downloads140Pub points
AndroidiOSmacOSWindowsLinux
hacker-cb/modbus-dart open-source repository details.
English project snapshot. Visit GitHub for the latest content.
Simple Modbus client library for dart. Currently only the TCP connection is supported.
import 'package:modbus/modbus.dart' as modbus;
main(List<String> arguments) async {
var client = modbus.createTcpClient(
'10.170.1.20',
port: 1001,
mode: modbus.ModbusMode.rtu,
);
try {
await client.connect();
var slaveIdResponse = await client.reportSlaveId();
print("Slave ID: " + slaveIdResponse);
} finally {
client.close();
}
}
import 'package:modbus/modbus.dart' as modbus;
main(List<String> arguments) async {
var client = modbus.createTcpClient(
'10.170.1.20',
port: 1001,
mode: modbus.ModbusMode.rtu,
);
try {
await client.connect();
client.setUnitId(100);
var slaveIdResponse = await client.reportSlaveId();
print("Slave ID: " + slaveIdResponse);
client.setUnitId(150);
var slaveIdResponse = await client.reportSlaveId();
print("Slave ID: " + slaveIdResponse);
} finally {
client.close();
}
}
SerialConnector is not implemented yet.
Start with your use case, compare repository activity, and check the original project before adopting it.
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗