i dont have any error
the output is nothing and "time.sleep(1)" is runs.
the code is here
https://github.com/ionutpi/DHT22-Python-library-Orange-PI
defined in >>dht22.py
in class DHT22
import time
from pyA20.gpio import gpio
from pyA20.gpio import port
#import RPi
class DHT22Result:
'DHT22 sensor result returned by DHT22.read() method'
ERR_NO_ERROR = 0
ERR_MISSING_DATA = 1
ERR_CRC = 2
error_code = ERR_NO_ERROR
temperature = -1
humidity = -1
def __init__(self, error_code, temperature, humidity):
self.error_code = error_code
self.temperature = temperature
self.humidity = humidity
def is_valid(self):
return self.error_code == DHT22Result.ERR_NO_ERROR
class DHT22:
'DHT22 sensor reader class for Raspberry'
__pin = 0
def __init__(self, pin):
self.__pin = pin
def read(self):
gpio.setcfg(self.__pin, gpio.OUTPUT)
# send initial high
self.__send_and_sleep(gpio.HIGH, 0.05)
# pull down to low
self.__send_and_sleep(gpio.LOW, 0.02)
# change to input using pull up
#gpio.setcfg(self.__pin, gpio.INPUT, gpio.PULLUP)
gpio.setcfg(self.__pin, gpio.INPUT)
gpio.pullup(self.__pin, gpio.PULLUP)
# collect data into an array
data = self.__collect_input()
# parse lengths of all data pull up periods
pull_up_lengths = self.__parse_data_pull_up_lengths(data)
# if bit count mismatch, return error (4 byte data + 1 byte checksum)
if len(pull_up_lengths) != 40:
return DHT22Result(DHT22Result.ERR_MISSING_DATA, 0, 0)
& ....