Open hasenradball opened 6 months ago
@lurch Hi,
added in short a cpp example for the AM2302-sensor. It is possible to add to the pico examples?
It makes the main file a little more cleaner :-)
As I might have mentioned before, I only provide "(hopefully) helpful comments", it's not my decision whether to merge PRs in pico-sdk
or pico-examples
. But my first helpful comment would be that you need to target your PR against develop
instead of master
:wink:
@lurch Thanks for the hint. You are totally right.
:-)
How is this different from the DHT22 code you've added? Or are you adding this as an example of how to use C++?
@peterharperuk Hi Peter, the idea was to add this as C++ Example. I got the info in the morning that cpp in gerneral is possible… using classes and instatiation and all this stuff. Then I tried it directly. It makes the main file a little cleaner. Could be an example how it looks like in cpp style. One thing is different here. When call method begin() there is a check if sensor is connected.
And maybee here could also the check placed to distinguish between DHT11 or DHT22.
Best regards Frank
@peterharperuk One other thing ist also improved. If you poll the sensor too often which means < 2 s . Then status is -3 and the read function is not called.
So code is slightly improved. please try it.
So in short:
ìs sensor connected check
check of read frequency
@lurch can you please give a review for this PR.
As I might have mentioned before, I only provide "(hopefully) helpful comments", it's not my decision whether to merge PRs in
pico-sdk
orpico-examples
.
@lurch I thought so because you are mentioned as reviewer, sorry for the missunderstanding.
I think GitHub just treats any comment on the code as a "review" :facepalm:
@peterharperuk
Added the following features:
Added screenshot how example looks:
Add a C++ Example for AM2302-Sensor.