-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
119 additions
and
109 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,22 +1,25 @@ | ||
# SPDX-FileCopyrightText: 2024 Mike Causer <https://github.com/mcauser> | ||
# SPDX-License-Identifier: MIT | ||
|
||
""" | ||
MicroPython HDC1080 Basic example | ||
Prints the temperature and humidity every 500ms | ||
""" | ||
|
||
from machine import I2C, Pin | ||
i2c = I2C(0) | ||
|
||
from machine import I2C | ||
from hdc1080 import HDC1080 | ||
|
||
i2c = I2C(0) | ||
hdc = HDC1080(i2c) | ||
|
||
from time import sleep_ms | ||
|
||
hdc.config(humid_res=14, temp_res=14, mode=0, heater=0) | ||
|
||
if hdc.check(): | ||
print(f'Found HDC1080 with serial number {hdc.serial_number()}') | ||
print(f"Found HDC1080 with serial number {hdc.serial_number()}") | ||
|
||
while True: | ||
print(f'{hdc.temperature()} C, {hdc.humidity()} RH') | ||
sleep_ms(500) | ||
print(f"{hdc.temperature()} C, {hdc.humidity()} RH") | ||
sleep_ms(500) |
This file contains 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 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 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 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