Electronic Scale
1.Electronic scale information
Host Model |
D1w |
---|---|
Measuring range |
100g-15kg/30kg(Double range) |
Certified division value |
5g/10g |
Safe overload (%FS) |
120 |
Destroy overload (%FS) |
150 |
Working temperature (℃) |
-10℃~40℃ |
Working humidity |
10%~85% No condensation |
Creep(%FS/30min) |
+-0.02 |
Equipment dealer/model |
W23 |
Porter rate |
9600 |
Access mode |
Serial(/dev/ttyS4) |
3.Electronic scale software development
The method of application
Link Electronic scale sdk downloads
Binding the electronic scale service to obtain relevant data for the electronic scale
Initialization
Open the serial port and obtain the net weight and state of the electronic scale by means of an interface callback
1Electronic mElectronic = new Electronic.Builder()
2//default path
3.setDevicePath(“/dev/ttyS4”)
4//default porter rate
5.setBaudrate(9600)
6.setReceiveCallback(new ElectronicCallback {
7@Override
8public void electronicStatus(String weight, String weightStatus) {
9//Callback in child thread
10 ...
11}})
12 .builder()
Parameters |
Description |
---|---|
Weight |
Unit(kg) |
scale state |
46:overweight, 53:Normal, 55:unstable, 56:Successful manual peeling, 57: Failure of manual peeling |
Get the function of zero clearing and peeling of electronic scale by direct calling method
zero clearing
mElectronic.turnZero()
Weigh with tare removal
mElectronic.removePeel()
Manual peeling
mElectronic.manualPeel(int peelWeight)
Turn off the electronic scale
mElectronic.closeElectronic()
Hybrid uses WebView to call the scale
JavaScript API to call the scale
iMin provides electronic scale service plug-in, users can search for iMinprinter plug-in through iMin App Store, download and install, and print web content through the browser using the electronic scale function.
- Demo Case(You can open your chrome browser and enter the URL below to experience.)
Use JavaScript API
Establishing a connection can be done in the following 3 steps:
Download the JS library file Download the JS library
Add the js file to your project
Initialize the connection
Get the scale weight
Function:void electronicScaleGetWeight()
1//Initialize the connection
2var IminPrintInstance = new IminPrinter();
3
4IminPrintInstance.connect().then(async (isConnect) => {
5 if (isConnect) {
6 var weight = 0;
7 // Get the scale weight
8 IminPrintInstance.electronicScaleGetWeight(function (data) {
9 // alignmentMode Scale status code: 53=normal; 46=overweight; 55=No Stable Weight
10 // weight The weight of the item that the scale currently weighs
11 if (data.alignmentMode === 53) {
12 weight = data.weight;
13 console.log('weight:'+ weight);
14 } else {
15 if (data.alignmentMode === 46) {
16 console.log('Exceeding maximum weight');
17 } else {
18 console.log('The state is unstable');
19 }
20 }
21 })
22 }
23})
parameter:
alignmentMode –> Scale status code: 53=normal; 46=overweight; 55=No Stable Weight weight –> The weight of the item that the scale currently weighs
Electronic scale peeling
Function:void electronicScaleRemovePeel()
1IminPrintInstance.electronicScaleRemovePeel();
Zero the electronic scale
Function:void electronicScaleTurnZero()
1IminPrintInstance.electronicScaleTurnZero();
End of weighing
Function:void electronicScaleEnd()
1IminPrintInstance.electronicScaleEnd();