I am doing a Home Automation Senior Project and my Amazon Alexa App is not finding the ESP8266 when I run the code I get this in the Serial Monitor. Can anyone please help me
Responding search req...
����������������������������������������������������������������ot-Found HTTP call:
URI: /api/2WLEDHardQrI3WHYTHoMcXHgEspsM8ZZRpSKtBQr/lights/1988806784
Body:
AlexaApiCall
ok
l1988806784
1988806784
Got UDP!
M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Man: "ssdp:discover"
MX: 3
#ifdef ARDUINO_ARCH_ESP32
#include <ESPmDNS.h>
#include <WiFi.h>
#else
#include <ESP8266mDNS.h>
#include <ESP8266WiFi.h>
#endif
#define ESPALEXA_DEBUG
#include <Espalexa.h>
#define RelayPin1 5
boolean connectWifi();
void firstLightChanged(uint8_t brightness);
const char* ssid = "BCUStudents";
const char* password = "";
String Device_1_Name = "Yellow LED";
boolean wifiConnected = false;
Espalexa espalexa;
void setup() {
Serial.begin(9600);
pinMode(RelayPin1, OUTPUT);
wifiConnected = connectWifi();
if (wifiConnected)
{
espalexa.addDevice(Device_1_Name, firstLightChanged);
espalexa.begin();
} else {
while (1) {
Serial.println("Can't Connect to WiFi. Please Try Again");
delay(2500);
}
}
}
void loop() {
espalexa.loop();
delay(1);
}
void firstLightChanged(uint8_t brightness) {
if (brightness == 255) {
digitalWrite(RelayPin1, LOW);
Serial.println("Device1 OFF");
} else {
digitalWrite(RelayPin1, HIGH);
Serial.println("Device1 ON");
}
}
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;
}
