I have a .dat file of 400 values from 0 through 5. They are stored as single byte values.
How can I place them into a PROGMEM compatible format?
I'd be willing to copy from a text display and paste into an Arduino sketch.
Thank you,
Bob LeDoux
I have a .dat file of 400 values from 0 through 5. They are stored as single byte values.
How can I place them into a PROGMEM compatible format?
I'd be willing to copy from a text display and paste into an Arduino sketch.
Thank you,
Bob LeDoux
#!/usr/bin/env python3
identifier = "data"
filename = "data.dat"
with open(filename, "rb") as f:
data = f.read()
print("const byte " + identifier + "[] PROGMEM = {", end=" ")
for byte in data:
print(int(byte),end=", ")
print("};")
Pieter