-
Notifications
You must be signed in to change notification settings - Fork 17
adding methods to setup critical/upper and lower temperatures #29
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
755c0b4
adding methods to setup critical/upper and lower temperatures
jposada202020 2cbb426
updating docstrings
jposada202020 28ac104
adding_example, changing_docs, adding_const_values, adding resolution
jposada202020 2cca083
adding Register library and simplify logic
jposada202020 ce1dca5
adding doc_inline
jposada202020 829bc12
adding doc_inline
jposada202020 693758d
improving_example
jposada202020 e2924c7
Update adafruit_mcp9808.py
jposada202020 1ce4980
Update adafruit_mcp9808.py
jposada202020 29ff153
Update adafruit_mcp9808.py
jposada202020 81051e6
Update adafruit_mcp9808.py
jposada202020 72b1b88
Update adafruit_mcp9808.py
jposada202020 98db33c
Update adafruit_mcp9808.py
jposada202020 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# SPDX-FileCopyrightText: 2021 Jose David M. | ||
# SPDX-License-Identifier: MIT | ||
|
||
""" | ||
Show the MCP9808 to setup different temperature values | ||
""" | ||
|
||
import time | ||
import board | ||
import adafruit_mcp9808 | ||
|
||
i2c = board.I2C() # uses board.SCL and board.SDA | ||
mcp = adafruit_mcp9808.MCP9808(i2c) | ||
|
||
# Change the values according to the desired values | ||
print("Setting Temperature Limits") | ||
mcp.upper_temperature = 23 | ||
mcp.lower_temperature = 10 | ||
mcp.critical_temperature = 100 | ||
|
||
# To verify the limits we need to read the temperature value | ||
print(mcp.temperature) | ||
time.sleep(0.3) # This is the time temperature conversion at maximum resolution | ||
|
||
# Showing temperature Limits | ||
while True: | ||
if mcp.below_lt: | ||
print("too cold!") | ||
if mcp.above_ut: | ||
print("getting hot!") | ||
if mcp.above_ct: | ||
print("Above critical temp!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.