Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By ridge
#24312 I have Irrigation_3 running on two of the esp-12's for over 24 hours with zero wdt events.

My toolchain is as follows:
Ubuntu linux 32bit 12.04LTS laptop development computer.
Arduino IDE 1.6.5
igrr's esp8266/Arduino version 0.4.4
WebConfig 1.1.3 - 2015-07-20


I know there is esp8266/Arduino version 0.4.5 available, but esptool-0.4.5-linux32.tar.gz is not ready yet.

The esp8266 development boards I have are powered by batteries, so power supply ripple or voltage sag during momentary high current requirements are not likely to be an issue for me.

I can only test against the hardware I have, and for me WebConfig is rock solid after the explanation Makuna gave on how to access constant character strings stored in flash memory.

Makuna ported the PROGMEM function into the esp8266/Arduino package from the AVR Arduino library. I am fairly certain his opinion on the matter is correct. ;)

For me, the wdt issues are gone. Lately I am spending time trying to learn HTML and CSS.

I vote the embedded controls C/C++ guys treat web developers and UI designers nice on this forum! Their artistic skills for great looking user interfaces will be welcome!

Attached is Irrigation_4
It is the same as Irrigation_3 with the addition of slider controls for pwm control of the RGB led on the yellow development board. I finally figured out how to pass variable values from the web page into the .ino code without doing a flash memory save first. This should help the flash memory last much longer when the data does not need to persist across power cycles.

Login to download Irrigation_4.
You do not have the required permissions to view the files attached to this post.
User avatar
By danbicks
#24375 @Ridge,

Awesome work buddy, the passing variables will be really handy for my needs, love the addition of slider controls. Excellent work mate.

@CurlyWurly great analysing of code differences. I have the latest build stable Arduino and latest 1.5 IDE.

I have ordered some more ESP12 dev boards, I will try the Ridge version on this before I get to involved in looking at the WDT issue. Really good work guys :)

Dans
User avatar
By ridge
#24401 Irrigation_4 has a small bug in the RGB led operation.

The esp8266 is a 32bit device. I set the range of the value to pass to analogWrite correctly in the web page. 0 to 1023 is correct.

In global.h the following changes need to be made.

From:
byte LED_R;
byte LED_G;
byte LED_B;

To:
long LED_R;
long LED_G;
long LED_B;

Now the values from the webpage for the analogWrite command are not limited from 0 to 255.
PWM is very useful for a lot of things, the default frequency I measured is about 1000Hz.
Now that the pwm duty cycle is under control, the frequency will be the next thing to study.
User avatar
By martinayotte
#24478
martinayotte wrote:It build again a String in RAM to add header, and then pass it to sendContent() function which is in fact sending the content with multiple chunks of HTTP_DOWNLOAD_UNIT_SIZE (defined as 1460).
What we need is to have a fix in WebServer by adding a new send() and a new sendContent() functions which should deal with PROGMEM separately from the header, having the header in RAM and then sending content chucks directly from PROGMEM using memccpy_P() (defined in pgmspace.cpp) until the last chunk.

I've just saw that IGRR has done a PR merge with new code from Makuna, so it is now possible to pass a PROGMEM directly to new WebServer.send_P() function, it should save a lot of memory.
https://github.com/esp8266/Arduino/comm ... 86307cbda4
(notice that it is not in a JSON package yet, but manual merge can be done in your own tree)