Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional C++ Example for AM2302-Sensor #450

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

hasenradball
Copy link

@hasenradball hasenradball commented Dec 19, 2023

Add a C++ Example for AM2302-Sensor.

@hasenradball
Copy link
Author

hasenradball commented Dec 19, 2023

@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 :-)

@lurch
Copy link
Contributor

lurch commented Dec 19, 2023

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 😉

@hasenradball hasenradball changed the base branch from master to develop December 19, 2023 08:04
@hasenradball
Copy link
Author

@lurch Thanks for the hint.
You are totally right.

:-)

@hasenradball hasenradball changed the title Add additional C++ Example for AM2302_sensor Add additional C++ Example for AM2302-Sensor Dec 19, 2023
@peterharperuk
Copy link
Contributor

How is this different from the DHT22 code you've added? Or are you adding this as an example of how to use C++?

@hasenradball
Copy link
Author

@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

@hasenradball
Copy link
Author

hasenradball commented Dec 19, 2023

@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:

  • added ìs sensor connected check
  • added check of read frequency

@hasenradball
Copy link
Author

@lurch can you please give a review for this PR.

@lurch lurch removed their request for review January 30, 2024 10:19
@lurch
Copy link
Contributor

lurch commented Jan 30, 2024

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.

@hasenradball
Copy link
Author

@lurch I thought so because you are mentioned as reviewer, sorry for the missunderstanding.

@lurch
Copy link
Contributor

lurch commented Jan 30, 2024

I think GitHub just treats any comment on the code as a "review" 🤦

@hasenradball
Copy link
Author

hasenradball commented Apr 25, 2024

@peterharperuk

Added the following features:

  • better human readable error output
  • example with sensor array

Added screenshot how example looks:

20240425_16h59m19s_grim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants