I have a text file with hex values formatted in the following style:
A0 3F 55 01 00 C7 55 01 00 C7 AA 29 71 11 00 0B
00 C7 AA 29 71 1F AA 29 71 11 55 01 A0 3F 55 DC
...
How can I save this data into my Arduino's Flash (to save RAM)? What libraries are needed? Is there any tool that can automatically create code for this purpose?
After I save this data into the Arduino's Flash, I want to send the data via Serial. I have to send it as binary.
A solution without saving it into the Flash would be also OK.
I am using an Arduino Due.
objcopy
to turn it into a.o
file, fabricate an appropriate.h
file containing the symbols in the.o
file, and then compile against the.h
and link against the.o
.,
, prepend0x
to the start of each pair, so you get0xA0, 0x3F, 0x55, ...
, then wrap it inconst byte myData[] PROGMEM = { ... your data ... };
- Personally I would write a small script to do it in Perl or PHP (I loathe Python with a passion).