MassaK.Plugin
1.0.2
dotnet add package MassaK.Plugin --version 1.0.2
NuGet\Install-Package MassaK.Plugin -Version 1.0.2
<PackageReference Include="MassaK.Plugin" Version="1.0.2" />
paket add MassaK.Plugin --version 1.0.2
#r "nuget: MassaK.Plugin, 1.0.2"
// Install MassaK.Plugin as a Cake Addin #addin nuget:?package=MassaK.Plugin&version=1.0.2 // Install MassaK.Plugin as a Cake Tool #tool nuget:?package=MassaK.Plugin&version=1.0.2
Usage
Setup MassaK
This code creates MassaK Instance without connecting.
It is recommended to subscribe to OnStatusChanged and OnWeightChanged before using method Connect()
using MassaK.Plugin
using MassaK.Plugin.Imp;
IMassaK MassaK = new MassaUsb("COM6");
MassaK.OnStatusChanged += ReceiveStatus;
MassaK.OnWeightChanged += ReceiveWeight;
Connect
This method is safely for use, no exceptions only event StatusChanged
.
MassaK.Connect();
Get weight
This method requests weight data from the scales. The argument specifies the interval in milliseconds between requests. A smaller value means faster polling, with a minimum of 100 milliseconds (use cautiously). Use OnWeightChanged event
MassaK.StartWeightPolling(100);
Calibrate
Ensure there is no weight placed on the scales before connecting them via USB. If any issues arise, reconnect the scales via USB.
MassaK.Сalibrate();
Disconnect
MassaK.Disconnect();
After calling Disconnect, you can reconnect the object again that's why you need to call Dispose()
for full destroy.
Or call only Dispose()
without Disconnect()
MassaK.Dispose();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-windows10.0.19041 is compatible. |
-
net8.0-windows10.0.19041
- System.IO.Ports (>= 8.0.0)
- System.Management (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.