Datenauswertung mit EmbAJAX

/* Basic usage example for EmbAJAX library:
* This simply creates a page with one instance of each input element available at the time
* of this writing. The right hand side has displays to show some sort of value for each (after a
* round-trip to the server).
* 
* This example code is in the public domain (CONTRARY TO THE LIBRARY ITSELF). */

#include <EmbAJAX.h>
#include <EmbAJAXValidatingTextInput.h> // Fancier text input in a separate header file
#include <EmbAJAXScriptedSpan.h>

// Set up web server, and register it with EmbAJAX. Note: EmbAJAXOutputDriverWebServerClass is a
// convenience #define to allow using the same example code across platforms
EmbAJAXOutputDriverWebServerClass server(80);
EmbAJAXOutputDriver driver(&server);

#define BUFLEN 30
int LED=0;
// Define the main elements of interest as variables, so we can access to them later in our sketch.
EmbAJAXCheckButton check("check", "LED");
EmbAJAXMutableSpan check_d("check_d");
EmbAJAXMutableSpan test("check_d");


EmbAJAXValidatingTextInput<16> valtext("valtext");
EmbAJAXMutableSpan valtext_d("valtext_d");
char valtext_d_buf[BUFLEN];

EmbAJAXStatic nextCell("</td><td>&nbsp;</td><td><b>");
EmbAJAXStatic nextRow("</b></td></tr><tr><td>");

// Define a page (named "page") with our elements of interest, above, interspersed by some uninteresting
// static HTML. Note: MAKE_EmbAJAXPage is just a convenience macro around the EmbAJAXPage<>-class.
MAKE_EmbAJAXPage(page, "EmbAJAX example - Inputs", "",
    new EmbAJAXStatic("<table cellpadding=\"10\"><tr><td>"),
    &check,
    &nextCell,  // Static elements can safely be inserted into the same page more than once!
    &check_d,
    &nextRow,

    new EmbAJAXConnectionIndicator(),
    new EmbAJAXStatic("</b></td></tr></table>")
)

void setup() {
    pinMode (2,OUTPUT);
    Serial.begin(9600);
    // Example WIFI setup as an access point. Change this to whatever suits you, best.
    WiFi.mode(WIFI_AP);
    WiFi.softAPConfig (IPAddress (192,168,4,1), IPAddress (0,0,0,0), IPAddress (255,255,255,0));
    WiFi.softAP("EmbAJAXTest", "12345678");

    // Tell the server to serve our EmbAJAX test page on root
    // installPage() abstracts over the (trivial but not uniform) WebServer-specific instructions to do so
    driver.installPage(&page, "/", updateUI);
    server.begin();

    valtext.setPlaceholder("192.168.1.1");
    valtext.setPattern("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");

    updateUI(); // init displays
}

void updateUI() {
    // Update UI. Note that you could simply do this inside the loop. However,
    // placing it here makes the client UI more responsive (try it).
check_d.setValue(check.isChecked() ? "ON" : "OFF");
    
  }

void loop() {
// handle network. loopHook() simply calls server.handleClient(), in most but not all server implementations.
driver.loopHook();

Serial.printf(check.isChecked() ? "ON" : "OFF" );
Serial.println();delay(500);
}

Moin, wie stelle ich es an, mit obiger Auswertung eine Variable zuzuweisen?
z.B. Bei Darstellung "ON" LED=1 bei OFF LED=0.
Der Code als solcher macht was er soll, ich hab nur keine Ahnung mehr, 
wie man da eine Variablenzuweisung raus bekommt.
Danke


bool isC = check.isChecked();

Gruß Tommy

Jo, das war's. Danke dir, wenn ich das richtig verstanden habe, muss die Variable bei der Zuweisung(!) ausdrücklich als 'bool' definiert werden. Das hatte ich so nicht auf dem Schirm.
Gruß Thomas

Hier wird Anlegen als bool und zuweisen in 1 Zeile gemacht. Du kannst auch erst anlegen und später zuweisen. Sichtbarkeit und Gültigkeitsbereich beachten.

bool isC;
...
// irgendwann später
isC = check.isChecked();

Gruß Tommy

So in der Richtung hatte ich auch schon probiert, hab mich dabei aber wohl irgendwie verheddert. Danke für deine Ausführungen.