Skip to content

Wrote this for the purpose of interfacing with a Mettler-Toledo PS60 scale, but it should work for any other scale that supports the "Universal Serial Bus HID Point of Sale Usage Tables."

License

Notifications You must be signed in to change notification settings

plirr/pyusb-scale

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyusb-scale

Wrote this for the purpose of interfacing with a Mettler-Toledo PS60 scale, but it should work for any other scale that supports the Universal Serial Bus HID Point of Sale Usage Tables.

Requires PyUSB.

Run tests from the project root with unittest2:

unit2 discover

Feature-complete, but not yet production-tested. Be prepared to fix and extend this library as you have need. (And remember to issue pull requests for your changes!)

Example

Assuming you've pulled this repository into a directory called scale:

from scale import Scale
scale = Scale()
reading = scale.weigh()

Assuming you're weighing a 1 pound object and your scale is set to "pounds":

reading.weight == 1.0 # True
reading.unit == "pounds" # True

This is a very simple example. If you want to dive in deeper, try examining the unit tests.

About

Wrote this for the purpose of interfacing with a Mettler-Toledo PS60 scale, but it should work for any other scale that supports the "Universal Serial Bus HID Point of Sale Usage Tables."

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages