Replies: 2 comments 12 replies
-
|
For small numbers (between 0 and 255), not much conversion is required. Here is an example: from pybricks.hubs import PrimeHub
hub = PrimeHub()
# In this example we alway store it at the start of the memory.
START = 0
# Each number may be between 0 and 255
write_values = [7, 8, 9, 35, 200]
print("I store", write_values)
hub.system.storage(START, write=bytes(write_values))
# You can read it now. Even if you delete the values above
# the second time. Even after restart.
read_values = [v for v in hub.system.storage(START, read=5)]
print("I read ", read_values) |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
Hi! How could we store and read float numbers? |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone!
We try to store the B&W light intensity values and read later in a line follower code with "system.storage". We don´t quite understand how to store and read binary data and then convert it to a number we could use as light intensity. Can anyone explain how it can be done and give an example if possible?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions