Skip to content

Commit f8fc83f

Browse files
authored
Merge pull request #4 from tekktrik/fix/update-value-error
Update ValueError raised when storing non-integer in index
2 parents f5c5b3c + 84e610b commit f8fc83f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

adafruit_24lc32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def __setitem__(self, address, value):
143143

144144
if isinstance(address, int):
145145
if not isinstance(value, int):
146-
raise ValueError("Data must be a single integer for single addresses")
146+
raise ValueError("Data stored in an address must be an integer 0-255")
147147
if not 0 <= address < self._max_size:
148148
raise ValueError(
149149
"Address '{0}' out of range. It must be 0 <= address < {1}.".format(

examples/24lc32_simpletest.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2021 Tim Cocks for Adafruit Industries
22
#
33
# SPDX-License-Identifier: Unlicense
4+
45
import board
5-
import adafruit_eeprom
6+
import adafruit_24lc32 as adafruit_eeprom
67

78
i2c = board.I2C()
89
eeprom = adafruit_eeprom.EEPROM_I2C(i2c)
@@ -12,8 +13,5 @@
1213
eeprom[0] = 4
1314
print(eeprom[0])
1415

15-
# eeprom[0:3] = [9, 3, 8, 1]
16-
# print(eeprom[0:3])
17-
18-
while True:
19-
pass
16+
eeprom[0:4] = [9, 3, 8, 1]
17+
print(eeprom[0:4])

0 commit comments

Comments
 (0)