Skip to main content

PyNAU7802

Python port of the SparkFun Qwiic Scale NAU7802 Arduino Library

Install

To install, simply use : pip install PyNAU7802 in a terminal window

How to use

The function name and arguments are the exact same as the original library, use it's documentation to get started.

Examples

Multiple examples are available in the examples/ directory.

This package use smbus2 as the I2C bus. Here is a small working example :

import PyNAU7802
import smbus2

# Create the bus
bus = smbus2.SMBus(1)

# Create the scale and initialize it
scale = PyNAU7802.NAU7802()
if scale.begin(bus):
    print("Connected!\n")
else:
    print("Can't find the scale, exiting ...\n")
    exit()

# Calculate the zero offset
print("Calculating the zero offset...")
scale.calculateZeroOffset()
print("The zero offset is : {0}\n".format(scale.getZeroOffset()))

print("Put a known mass on the scale.")
cal = float(input("Mass in kg? "))

# Calculate the calibration factor
print("Calculating the calibration factor...")
scale.calculateCalibrationFactor(cal)
print("The calibration factor is : {0:0.3f}\n".format(scale.getCalibrationFactor()))

input("Press [Enter] to measure a mass. ")
print("Mass is {0:0.3f} kg".format(scale.getWeight()))

Release files for pynau7802 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pynau7802 0.2.2
File Size Uploaded
pynau7802-0.2.2.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pynau7802 0.2.2
File Interpreter ABI Platform
pynau7802-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / pynau7802-0.2.2.tar.gz

Download URL pynau7802-0.2.2.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0ba267046efd0c9fd5a798be20d72fba7a6883d08376ea0adc6ff18d3ed6d8cc
BLAKE2b-256 checksum
How to use checksums
2a6cbc6d974cb25d9f82b42789214f8dccb8710b1c98fddf99943cec1d88c56b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.3 Windows/10

Release files / pynau7802-0.2.2-py3-none-any.whl

Download URL pynau7802-0.2.2-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e53075829178c21b154743791ab8d067c8d49935e7ca0a58cd9c2cfe259b3252
BLAKE2b-256 checksum
How to use checksums
472358079fff7274fb8c4dec2cea268b11f955bbaec10250ef87ee57eb2b99af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.3 Windows/10

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page