Skip to content

Example code single integer ValueError #29

Closed
@FoamyGuy

Description

@FoamyGuy

In the simpletest example there is commented out code that writes multiple bytes to the FRAM device at once:

# values = list(range(100)) # or bytearray or tuple
# fram[0] = values
# print(fram[0:99])

But if you uncomment and attempt to run this code it raises this error:

Traceback (most recent call last):
  File "code.py", line 31, in <module>
  File "adafruit_fram.py", line 173, in __setitem__
ValueError: Data must be a single integer for single addresses

I think the line writing the data needs to include a slice of the proper length like this:

fram[0:99] = values

I tested that locally and it seems to work, though I have very little experience with FRAM so I can't be certain it's correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions