Convert Windows file to PROGMEM .H file?

Is there a program out there that would let me drop a small Windows file on it, and which would convert it into a PROGMEM declaration?

Much like this output?


#include <avr/pgmspace.h>

prog_uint16_t sample[0x3] PROGMEM = {
0xAB00, 0x12AF, 0x55CC

What sort of file do you have in mind to start with ?

An actual example would be good

It is quite easy to write a little C or C++ program to read some file and create text output for such an array initialization statement.

I use Code::Blocks on Windows for that.

I normally write a small program in the processing language that prints the data into format I want for a specific application.
For example converting a list of numbers from a sound sample file into a C program memory deceleration. Or changing a small image to put into a display.

Then I simple copy from the output and paste into the Arduino .h file.

You can’t have a universal code to do this as you can’t anticipate what sort of output you will need, unless a simply copy and paste from a text editor will do.

Sorry for the delay! I didn't see my notifications.

I've wrote one, maybe others may find it useful?

I've gone with a HTML/JavaScript solution on CodePen. I linked to it on the thread. =)

Hi Grumpy_Mike,

I did as you suggested for my audio effects on github, and wrote it on CodePen... a little HTML/JavaScript thing.

I know other languages make this kind of thing easier - but I like making JS/HTML do things people wouldn't imagine it being the first choice for. =) I've linked to it on the thread elsewhere.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.