Adds ctypes wrapper for DHT sensors#53
Conversation
function, moves variable definitions into readDHT function to allow multiple reads.
on readDHT to suppress printing of raw data.
|
Very interesting! Unfortunately when I test it I got I compiled the lib like this (you should modify the Makefile to produce the lib in your patch, no?): $ gcc -std=c99 -l bcm2835 -shared -o libAdafruit_DHT.so -fPIC Adafruit_DHT.cI have already compiled and installed lcbm2835. Any clues? Thanks |
|
Not really, I'm no C expert. I just hacked it to get it to work nicely with the python in my case. I'm away from the Pi I've got this running on with the hardware for a little while but I'll get back to you once I've had a chance to fiddle with it again. |
|
Thanks for sending the pull request and apologies that it couldn't be reviewed earlier. We've actually deprecated this Adafruit_DHT_Driver code and refactored the DHT sensor reading C code into the Adafruit_Python_DHT library here: https://github.com/adafruit/Adafruit_Python_DHT I'll close this pull since the new library is the source for DHT interface code going forward. Thanks again for sending the pull request! |
Modifies DHT C code to give a read function that returns temp and humidity, and a ctypes python class wrapper for this. Updates the python example code to use this instead of subprocess.
Behaviour of C code unchanged when called from terminal.
Needs testing on DHT11 type sensors, I only have a DHT22.