utilize este codigo y cuando busco el dispositivo en la aplicacion de alexa tampoco lo detecta por eso es mi pregunta si sera que no este funcionando mas la libreria
la leyenda que me aparece es "No se ha encontrado ningun dispositivo."
/*
* This is a basic example on how to use Espalexa and its device declaration methods.
*/
#ifdef ARDUINO_ARCH_ESP32
#include <WiFi.h>
#else
#include <ESP8266WiFi.h>
#endif
#include <Espalexa.h>
// prototypes
boolean connectWifi();
//callback functions
void firstLightChanged(uint8_t brightness);
void secondLightChanged(uint8_t brightness);
void thirdLightChanged(uint8_t brightness);
// Change this!!
const char* ssid = "XXXXXXX";
const char* password = "XXXXXXX";
boolean wifiConnected = false;
Espalexa espalexa;
EspalexaDevice* device3; //this is optional
void setup()
{
Serial.begin(115200);
// Initialise wifi connection
wifiConnected = connectWifi();
if(wifiConnected){
// Define your devices here.
espalexa.addDevice("Light 1", firstLightChanged); //simplest definition, default state off
espalexa.addDevice("Light 2", secondLightChanged, 255); //third parameter is beginning state (here fully on)
device3 = new EspalexaDevice("Light 3", thirdLightChanged); //you can also create the Device objects yourself like here
espalexa.addDevice(device3); //and then add them
device3->setValue(128); //this allows you to e.g. update their state value at any time!
espalexa.begin();
} else
{
while (1) {
Serial.println("Cannot connect to WiFi. Please check data and reset the ESP.");
delay(2500);
}
}
}
void loop()
{
espalexa.loop();
delay(1);
}
//our callback functions
void firstLightChanged(uint8_t brightness) {
Serial.print("Device 1 changed to ");
//do what you need to do here
//EXAMPLE
if (brightness) {
Serial.print("ON, brightness ");
Serial.println(brightness);
}
else {
Serial.println("OFF");
}
}
void secondLightChanged(uint8_t brightness) {
//do what you need to do here
}
void thirdLightChanged(uint8_t brightness) {
//do what you need to do here
}
// connect to wifi – returns true if successful or false if not
boolean connectWifi(){
boolean state = true;
int i = 0;
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.println("");
Serial.println("Connecting to WiFi");
// Wait for connection
Serial.print("Connecting...");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
if (i > 20){
state = false; break;
}
i++;
}
Serial.println("");
if (state){
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
else {
Serial.println("Connection failed.");
}
return state;
}
gracias surbyte ! tendras idea de como podria enlazar mi esp de alguna forma o con otra libreria con alexa ? estuve buscando info y no logro encontrar info actual
estaba revisando las caracteristicas de la libreria y puede ser que al notener un echo no encuentre el esp aunque esta este conectado a mi wifi y utilize la aplicacion alexa ? porque el dispositivo si esta conectado dejo otra imagen abajo
Hola, en mi caso utilizo otra librerĂa, la de fauxmo, supongo q funcionarán por el estilo, y si, necesitas un Alexa fĂsicamente, Show, dot, el q sea, para q te encuentre los dispositivos, en este caso el Esp y te añada a la app los dispositivos virtuales q le hayas configurado.