1

I am teaching a child C programming with the RPi using a project with the DHT 11. I'm coming from Python and Node on the RPi but haven't done I/O on the RPi in C. What are some available libraries we could use, where would I find them, and what are their benefits?

1
  • You had two not-very-related questions here so I have remove the second one. WRT reading from /dev nodes, it depends on the node but it is not really pi specific and questions about this would be better off on Stack Overflow or Unix & Linux. However, a major purpose in using a file node based interface is to make it language agnostic, i.e., you are literally just reading and writing from them as if they were normal files (although they may be a bit less flexible in some ways).
    – goldilocks
    Nov 29, 2016 at 15:30

3 Answers 3

4

For the GPIO libraries available on the Pi see

http://elinux.org/RPi_GPIO_Code_Samples

For C the usual choices are

1

Personally I'd go with the bcm2835 library as its closest to the hardware. If you want to work with a DHT11 then see: A Custom Protocol - The DHT11/22

Which covers the entire how to use the DHT22 in more detail than you could ever need :-)

0

Use WiringPi - http://wiringpi.com/ - it has a simplified API, but that's entirely optional... you can do everything you can do in C/C++.

The documentation and examples are excellent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.