Git Product home page Git Product logo

dht11_python_orangepi's Introduction

DHT11 Python library (for Orange Pi WiringPi)

This simple class can be used for reading temperature and humidity values from DHT11 sensor on Orange pi SBCs.

Based on szazo/DHT11_Python, and referenced from somnisomni/DHT11_Python_Odroid.

Tested on Orange pi zero 2w.

require wiringOP-Python

Installation

To install, clone this repository and setup:

$ git clone https://github.com/wwwhana/DHT11_Python_OP
$ cd DHT11_Python_OP
$ pip3 install .  # or with `sudo`

Usage

  1. Instantiate the DHT11 class with the pin number as constructor parameter.
  2. Call read() method, which will return DHT11Result object with actual values and error code.

For example:

import wiringpi
import dht11

# initialize WiringPi
wiringpi.wiringPiSetup()

# read data using pin 4
instance = dht11.DHT11(pin = 4)
result = instance.read()

if result.is_valid():
    print("Temperature: %-3.1f C" % result.temperature)
    print("Humidity: %-3.1f %%" % result.humidity)
else:
    print("Error: %d" % result.error_code)

For working example, see example.py (you probably need to adjust pin for your configuration)

License

This project is licensed under the terms of the MIT license.

dht11_python_orangepi's People

Contributors

szazo avatar somnisomni avatar tteeoo avatar wwwhana avatar mtlynch avatar dragoneena12 avatar mountainash avatar pn11 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.