Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By Hulkco
#44574
matkar wrote:To correct the missing images substitute function:
void handle_image() with
Code: Select allvoid handle_image() {
  WiFiClient client = server.client();
  client.write(image, sizeof(image));
  server.send(200, "image/png", "");
}


I was searching for an application that would transform png images to the necessary byte array. Unfortunately I couldn't find any. If anybody knows where to get one, please let us know.

Hi the pgrogram that i used is: LCDassistand you can downloa here: https://github.com/hulkco/Tools

But we carefull, I'd suggest the following page:
https://learn.adafruit.com/mini-thermal ... p-printing
Though this one's about thermal printers, the tips all apply to LCD/OLED use as well...pad to multiple of 8, add PROGMEM to array declaration, etc. (One change: use the original bitmap width when calling drawBitmap(), only round up when doing the conversion.) :mrgreen:

For smaller pictures the parsing can be done manually with the help of some tools. I used http://www.fileformat.info/tool/hexdump.htm online service to convert my PNG to hex. I copied the result to libreoffice writer where I removed the unnecessary portions (columns) and added "0x" columns and commas to the array. This way it takes only a few minutes for a small picture to adapt it to the correct format.

Regards,
Mat
User avatar
By ceyhunkeklik
#45132 I working with ESP8266-01 and these codes working when I choose Board as Generic ESP8266 Module. Connected AP, Working WebServer but digitalWrite command not working. I tried 2,7,8 and 13 pin but not working in my Arduino Uno. How can I fix this problem?
User avatar
By RichardS
#45264 Are you sure its client.write, before server.send?

RichardS

Hulkco wrote:
matkar wrote:To correct the missing images substitute function:
void handle_image() with
Code: Select allvoid handle_image() {
  WiFiClient client = server.client();
  client.write(image, sizeof(image));
  server.send(200, "image/png", "");
}


I was searching for an application that would transform png images to the necessary byte array. Unfortunately I couldn't find any. If anybody knows where to get one, please let us know.

Hi the pgrogram that i used is: LCDassistand you can downloa here: https://github.com/hulkco/Tools

But we carefull, I'd suggest the following page:
https://learn.adafruit.com/mini-thermal ... p-printing
Though this one's about thermal printers, the tips all apply to LCD/OLED use as well...pad to multiple of 8, add PROGMEM to array declaration, etc. (One change: use the original bitmap width when calling drawBitmap(), only round up when doing the conversion.) :mrgreen:

For smaller pictures the parsing can be done manually with the help of some tools. I used http://www.fileformat.info/tool/hexdump.htm online service to convert my PNG to hex. I copied the result to libreoffice writer where I removed the unnecessary portions (columns) and added "0x" columns and commas to the array. This way it takes only a few minutes for a small picture to adapt it to the correct format.

Regards,
Mat