Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By pipi61
#27485 probe this:

woodwax wrote:Hello

sorry for my newbie question, I would like to use program memory space but the following code doesnt work:

Code: Select all#include <PgmSpace.h>

const char index_html[] PROGMEM = R"=====(
<head><title>ESP8266 Arduino Demo Page</title></head>
<body>ESP8266 power!<p><img src="logo.png"></body>

void setup() {

void loop() {

This is on ESP8266 e12 module with arduino IDE. When I run this code I get wdt error, can anyone correct this code? Thanks
User avatar
By martinayotte
#27507 Unfortunately, Serial.println() doesn't not support PROGMEM directly, and there is no Serial.println_P() method, since maybe there is no big needs for it.
So, you will need to do you own function using memccpy_P() to copy back the PROGMEM string into a local RAM buffer and loop until the end of string.
User avatar
By GregryCM
martinayotte wrote:... and for those who are on Windows, there is Hexy : https://github.com/tristan2468/Hexy/ ...

I downloaded the WiFi_Progmem.zip file, built and loaded into ESP01 without issue. I then made my own image.png file, used hexy to convert to hex array. The image would only partially load, then cause the EPS8266 to crash. I tried smaller images, simpler images, etc, but all would partially paint, then crash.

The fix was to pad the end of the hex array with enough 0x00's to ensure that the array size was a multiple of 16.

For example:
changes to:
User avatar
By martinayotte
#28566 For ESP crashes, maybe it is related to bug https://github.com/esp8266/Arduino/issues/596.

Are you using ESP8266WebServer ?

I've done some fixes on that yesterday, I've submit a PR to IGRR, waiting for merge.
(But you can grab the fixes and manually patch your environment)