-
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.
Merge pull request #2 from BlitzCityDIY/main
library and example
- Loading branch information
Showing
3 changed files
with
113 additions
and
4 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
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,4 +1,26 @@ | ||
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries | ||
# SPDX-FileCopyrightText: Copyright (c) 2024 Liz Clark for Adafruit Industries | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
# SPDX-License-Identifier: MIT | ||
|
||
import time | ||
import board | ||
import adafruit_s35710 | ||
|
||
i2c = board.I2C() | ||
|
||
timer = adafruit_s35710.Adafruit_S35710(i2c) | ||
|
||
timer.alarm = 5 | ||
print(f"The S-35710 alarm is set for {timer.alarm} seconds") | ||
|
||
countdown = timer.alarm - timer.clock | ||
|
||
while True: | ||
print(f"The S-35710 clock is {timer.clock}") | ||
countdown = timer.alarm - timer.clock | ||
if countdown == 0: | ||
timer.alarm = 5 | ||
print("Alarm reached! Resetting..") | ||
else: | ||
print(f"The alarm will expire in {countdown} seconds") | ||
time.sleep(1) |