User manual
003
String xBuffer;
004
005
for (int i = 0; i <= sizeof(site); i++)
006
{
007
char myChar = pgm_read_byte_near(site + i);
008
xBuffer += myChar;
009
}
010
011
xBuffer.replace("*bright*", String(analogRead(SENSOR)));
012
013
return xBuffer;
014
}
The placeholder is replaced in the function createWebsite(). First, the Progmem
variable is loaded from the memory as usual and saved in a string. Before the
function returns this string, however, all *bright*-strings are replaced by the value
currently measured at the sensor. The string function replace() will do the work
fully automatically. Finally, the changed string can be returned and transferred to
your browser by the known mechanisms.
4.7 | GPIO-Control
This new project permits simple control of the digital pins D2-D7 via the website.
The status of the respective pin is also presented in the browser, so that you will
never lose the overview.
To review the condition of the pin well, a setup as in the figure below is recom-
mended. Both the RGB-LED and the regular LED are used. The cathodes of the
LEDs are now not connected to the long ground line on the outside of the board,
but are also at a digital output. Only when these
pins are switched low can the LEDs light up.
Required parts
1 x pinboard, 1 x NanoESP, 1 x RGB-LED, 1 x LED (red),
circuit wire