Skip to content

Commit b46e79d

Browse files
committed
Update EEPROM example.
1 parent 39c33a9 commit b46e79d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

examples/seesaw_eeprom_test.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,17 @@
99
import board
1010
from adafruit_seesaw import seesaw
1111

12-
ss = seesaw.Seesaw(board.I2C())
13-
14-
write_value = 42
12+
i2c_bus = board.I2C()
13+
ss = seesaw.Seesaw(i2c_bus)
1514

1615
value = ss.eeprom_read8(0x02) # Read from address 2
1716
print("Read 0x%02x from EEPROM address 0x02" % value)
1817

19-
ss.eeprom_write8(0x02, write_value) # Write value to address 2
20-
print("Writing value")
18+
print("Incrementing value")
19+
ss.eeprom_write8(0x02, (value + 1) % 0xFF)
2120

2221
value = ss.eeprom_read8(0x02) # Read from address 2
23-
print("Read 0x%02x from EEPROM address 0x02" % value)
22+
print("Second read 0x%02x from EEPROM address 0x02" % value)
2423

2524
while True:
2625
# Do not write EEPROM in a loop, it has 100k cycle life

0 commit comments

Comments
 (0)