-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
fe1b8c1
commit b503b5c
Showing
2 changed files
with
79 additions
and
23 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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# SPDX-FileCopyrightText: 2020 by Bryan Siepert, written for Adafruit Industries | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
# pylint:disable=unused-import | ||
import time | ||
import board | ||
import busio | ||
from adafruit_ltr390 import LTR390, UV, ALS | ||
|
||
THRESHOLD_VALUE = 100 | ||
|
||
i2c = busio.I2C(board.SCL, board.SDA) | ||
ltr = LTR390(i2c) | ||
|
||
ltr.high_threshold = THRESHOLD_VALUE | ||
ltr.enable_alerts(True, UV, 1) | ||
|
||
while True: | ||
|
||
if ltr.threshold_passed: | ||
print("UV Index:", ltr.uv_index) | ||
print("threshold", THRESHOLD_VALUE, "passed!") | ||
print("") | ||
else: | ||
print("threshold not passed yet") | ||
|
||
time.sleep(1) |