-2

I am working on a project to transmit data using an array of LEDs. However I'm having trouble importing an image to an Arduino. Once I have imported the image I would like to convert it into a binary form so I can transmit the data stream. Could anyone help me find a way to do this or any references?

gre_gor
  • 6,669
  • 9
  • 47
  • 52
Krish
  • 1

2 Answers2

0

"Importing" is probably all you need to do, the classical approach is to use some tool like bin2c to convert the raw binary file into C source code, which can then be compiled into the project.

This moves the problem to "how do I convert an image to raw binary", which is of course done by various image manipulation tools. Note that raw binary doesn't have a way of expressing its size, which you normally want to have available at runtime, so you need to figure out a way to add that. Perhaps hard-coding it is okay for your application, of course.

unwind
  • 391,730
  • 64
  • 469
  • 606
0

First convert your image to binary with bin2c or this, then use PROGMEM to store the data and retrieve it.

Anyway, the image binary format will strongly depend on the format expected by your array of LEDs (is it B&W? RGB? What's the resolution?)