Grove DHT Sensor under C language


#1

Hello,
I am using a Raspberry Pi3 and I’d like to know if there is an example of C program to test my DHT sensor using grovepi.c library.
thanks,


#2

Just want to make sure: are you using the GrovePi+ attached to the Raspberry Pi?


#3

Yes I’m using the GrovePi+ attached to my RPI3 and the sensor is plugged through D5 port.


#4

Hi @Erazin,

We already have a library written in C++ - grove_dht_example.cpp
Please, pay attention to all the sources/headers you need before compiling the program.

If there’s anything unclear to how it should be run, please let us know and we’ll try to help you out.

Thank you!


#5

Hi @RobertLucian
It worked perfectly, I compiled the program and got my .out file.
I will be glad if you can do the same for C language.
Regards,


#6

Hi @Erazin,

Initially, we had a library written in C.
Then we moved on to C++, because the language it’s much more powerful and it provides OOP concepts.

If you have code written in C, then you can compile it with g++.
C++ is more strict with types, so you may need to tinker a little bit the C code in order to be fully compatible.

Also, why would you want to write in C instead of C++?
Are there any specific requirements/conditions for your application?

Thank you!