-
Notifications
You must be signed in to change notification settings - Fork 19
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
Loop #5
Comments
Hello, Glad to hear that it runs on a SHT25 and that you've been able to get it to work. I'm not sure what could be going wrong, but if you send it through I could take a look and see if I can see anything. Thanks for the feedback, most appreciated. |
Hey Jacques, I tried it two ways, firstly the code I am using for my other two sensors runs within a loop: while True:
|
I am sorry that ended up getting formatted and looking a complete mess, I wasn't expecting that. |
Ok, no worries. In Markdown (the formatting engine that github uses for comments) if you add an indent of say 4 spaces everything will format like code. It looks to me like the whole file isn't in the loop. In python whitespace is important, and if the I would recommend not doing quite so much in the main loop of the program. I suggest splitting it out into separate files. Here I've got sht21.py untouched in the same folder. If you move the code for the MS5611 code as well you might find it easier to deal with. I'm not able to run any of this code I include below, as I don't have a pi to hand, but hopefully you get the idea. If this proves to work, try moving the MS5611 code out as well and uncommenting the 3 lines to create the class, read the temperature and print the value. Let me know if you get stuck. Richard.
|
In case you were curious I've just recently made a similar module for the new SHT31 sensor, and tested it on raspberry pi 2 model b. |
i2cdetect -y 1 gives me UU instead of b30 so I guess that's my issue. It's not sht21.py |
Hello Jacques,
Firstly, let me thank you for producing this code for the SHT2x sensor.
At first I was getting the same error as some others due to not changing the i2c to bus 1 near the end of your code - but now I have it running on SHT25 sensor on bus 1. I did not have to change anything else so your code works just fine on the newer sensor too and I guess it would also for the SHT7x.
I have some code which returns results from 2 other sensors, a MCP9808 Temp sensor and MS5611 Barometric Pressure sensor. Neither written by me but I did manage to integrate them together into one and they run in a loop indefinitely and return results every 10 seconds.
When I try to integrate your code or loop your code, it goes crazy and returns results very quickly no matter what time.sleep I use.
My question is, if I may, and I hope you will forgive me as I am very new to all this:
If you could shed any light on anything obvious which would cause problem with looping? For my project I need to get results returning from my sensor array 24/7 at regular intervals.
Hope it is ok to contact you here, there is no issue with your code but I thought I would give you a try.
The text was updated successfully, but these errors were encountered: