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

Raising exception #1

Open
palmtreefrb opened this issue Dec 7, 2024 · 1 comment
Open

Raising exception #1

palmtreefrb opened this issue Dec 7, 2024 · 1 comment

Comments

@palmtreefrb
Copy link

palmtreefrb commented Dec 7, 2024

Found this library, it's perfect for my project. I did have to make a change to skip rather than raise an exception for my purpose. I just log the error and continue. I would have to restart app coroutine every time it threw an error. In my case I bumped the breadboard and accidentally pulled the GND wire out ;-)

Additionally I added a method to help eliminate the natural fluctuation in temp readings...

def average_measurement(self):
    averages = []  # List of readings
    temp = 0

    for measurement in range(128):  # Number of samples
        temp = self.read_temperature_fahrenheit()
        averages.append(temp)  # Read sensor and append reading to list
        time.sleep_ms(10)
        # print("Measured Avg Temperature:  " + str(temp) + " F")
    temp = int(sum(averages) / len(averages))
    return temp

Anyways nice library, thanks!!!

@Trexation
Copy link
Owner

I am glad to hear that you like the library! Thanks so much for telling me about your use case and suggesting improvements. I'm new to doing open source, but I will figure out how to add your averaging function to the code base. Thanks again!

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

No branches or pull requests

2 participants