diff --git a/adafruit_24lc32.py b/adafruit_24lc32.py index 348cd46..0a5d9c3 100644 --- a/adafruit_24lc32.py +++ b/adafruit_24lc32.py @@ -143,7 +143,7 @@ def __setitem__(self, address, value): if isinstance(address, int): if not isinstance(value, int): - raise ValueError("Data must be a single integer for single addresses") + raise ValueError("Data stored in an address must be an integer 0-255") if not 0 <= address < self._max_size: raise ValueError( "Address '{0}' out of range. It must be 0 <= address < {1}.".format( diff --git a/examples/24lc32_simpletest.py b/examples/24lc32_simpletest.py index 5617c0b..9211214 100644 --- a/examples/24lc32_simpletest.py +++ b/examples/24lc32_simpletest.py @@ -1,8 +1,9 @@ # SPDX-FileCopyrightText: Copyright (c) 2021 Tim Cocks for Adafruit Industries # # SPDX-License-Identifier: Unlicense + import board -import adafruit_eeprom +import adafruit_24lc32 as adafruit_eeprom i2c = board.I2C() eeprom = adafruit_eeprom.EEPROM_I2C(i2c) @@ -12,8 +13,5 @@ eeprom[0] = 4 print(eeprom[0]) -# eeprom[0:3] = [9, 3, 8, 1] -# print(eeprom[0:3]) - -while True: - pass +eeprom[0:4] = [9, 3, 8, 1] +print(eeprom[0:4])