Skip to content

Commit 928559d

Browse files
committed
eep
1 parent 213c7bc commit 928559d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

examples/seesaw_eeprom_test.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
4+
# Simple seesaw test reading and writing the internal EEPROM
5+
# The ATtiny8xx series has a true 128 byte EEPROM, the SAMD09 mimics it in flash with 64 bytes
6+
# THE LAST BYTE IS USED FOR I2C ADDRESS CHANGE!
7+
#
8+
# See the seesaw Learn Guide for wiring details:
9+
# https://learn.adafruit.com/adafruit-seesaw-atsamd09-breakout?view=all#circuitpython-wiring-and-test
10+
11+
import time
12+
import board
13+
from adafruit_seesaw import seesaw
14+
15+
i2c_bus = board.I2C()
16+
ss = seesaw.Seesaw(i2c_bus)
17+
18+
val = ss.eeprom_read8(0x02) # read from address 2
19+
print("Read 0x%02x from EEPROM address 0x02" % val)
20+
21+
print("Incremening value")
22+
ss.eeprom_write8(0x02, val + 1)
23+
24+
val = ss.eeprom_read8(0x02) # read from address 2
25+
print("Second read 0x%02x from EEPROM address 0x02" % val)
26+
27+
while True:
28+
# Do not write EEPROM in a loop, it has 100k cycle life
29+
time.sleep(1)

0 commit comments

Comments
 (0)