Skip to main content

GreenPonik DS198B20 One Wire read temperature

Project description

Quality Gate Status Maintainability Rating

Lines of Code Duplicated Lines (%)

Reliability Rating Security Rating Vulnerabilities

GreenPonik_OneWire_DS18B20.py Library for Raspberry pi


This is the sample code for read temperature with DS18B20 sensor on One Wire bus.

The script auto-detect the 1W file and parse it to find the temperature value.

Table of Contents

Installation

> git clone https://github.com/GreenPonik/GreenPonik_OneWire_DS18B20.git
from GreenPonik_OneWire_DS18B20.GreenPonik_OneWire_DS18B20 import read_temps

Methods

"""
Get temperatues in celcius and fahrenheit
"""
def read_temps():

Example

import time
from GreenPonik_OneWire_DS18B20.GreenPonik_OneWire_DS18B20 import read_temps

if __name__ == "__main__":
    while True:
        # read both celcius and fahrenheit temperatures
        temperatures = read_temps()
        print("celcius temp %.3f" % temperatures[0])
        print("fahrenheit temp %.3f" % temperatures[1])
        time.sleep(1)
    pass

Credits

Write by Mickael Lehoux, from GreenPonik, 2019

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

greenponik-onewire-ds18b20-0.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file greenponik-onewire-ds18b20-0.0.1.tar.gz.

File metadata

  • Download URL: greenponik-onewire-ds18b20-0.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for greenponik-onewire-ds18b20-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3f2e783077fafffe3d43a6c2fbe3b157459b05f5c46565f56ba9a347cc277eb9
MD5 8645cad801ea2e76edc195bfa63c4fed
BLAKE2b-256 64e227e210a851350459cdcf0b1b0006256689c22f48253a96ee80f2e899139f

See more details on using hashes here.

File details

Details for the file greenponik_onewire_ds18b20-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: greenponik_onewire_ds18b20-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for greenponik_onewire_ds18b20-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3fd9b02cf8c55beff63532a7f9d621c4268157a773f7c7c4919a9cfa20562b88
MD5 b62078f3fbb611ae516d2001075cf6a4
BLAKE2b-256 5daf3934a6c186d68d5540373c012891b1343b27ef5fb8c9df670e6040b39926

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page