Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

Adds ctypes wrapper for DHT sensors #53

Closed
wants to merge 4 commits into from

Conversation

nebulans
Copy link

@nebulans nebulans commented Aug 4, 2013

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.

@etienned
Copy link

Very interesting! Unfortunately when I test it I got OSError: ./libAdafruit_DHT.so: undefined symbol: bcm2835_gpio_lev.

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.c

I have already compiled and installed lcbm2835. Any clues?

Thanks

@nebulans
Copy link
Author

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.

@tdicola
Copy link
Contributor

tdicola commented Jun 9, 2014

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!

@tdicola tdicola closed this Jun 9, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants