Alex2ESP/test/readme/Configuration/Configuration.ino
David 1b8a5ff806 readme for 2.0: what it needs, quick starts, the interface table, the MQTT contract, log lines, memory, migration from 1.x
Rewritten along section 6a of the design. The Light example is in the
readme in full; the 13 other code blocks are excerpts of the examples and
of test/readme/Configuration/Configuration.ino, a sketch that exists to
compile the calls of the Configuration section (setServer, setTimeSource,
setLogLevel, AlexaLog::setOutput). The interface table says which six
interfaces Alexa drove from this library on 2026-09-28 and that the rest
is not tried. ESP32: never compiled. The changelog is in CHANGELOG.md.
Built for d1_mini: 17 examples and the Configuration sketch, 0 warnings;
147 host tests pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-28 22:13:44 +00:00

40 lines
1.1 KiB
C++

// The calls that readme.md shows under "Configuration", in a sketch that compiles. It is not an example and not
// a host test: it is built for d1_mini, with -DALEX2ESP_LOG_MAX=3, whenever that section of the readme changes.
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <Alex2ESP.h>
const char *WIFI_SSID = "";
const char *WIFI_PASSWORD = "";
const char *ALEXA_USERNAME = "";
const char *ALEXA_PASSWORD = "";
const char *ALEXA_ROOT_TOPIC = "";
Alex2ESP alexa;
void setup()
{
Serial.begin(74880);
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
// Another broker than alex2mqtt.stormysdream.club:1883. The text is not copied: a literal, or a buffer that stays
alexa.setServer("broker.example.org", 1883);
// The sketch sets the clock itself; the library then leaves SNTP alone
alexa.setTimeSource(false);
// NONE, ERROR, INFO (the default) or DEBUG; DEBUG needs -DALEX2ESP_LOG_MAX=3
alexa.setLogLevel(AlexaLogLevel::DEBUG);
// Where the lines go: any Print, Serial unless changed
AlexaLog::setOutput(&Serial);
alexa.begin(ALEXA_USERNAME, ALEXA_PASSWORD, ALEXA_ROOT_TOPIC);
}
void loop()
{
alexa.loop();
}