Salve, sto cercando di far accendere un LED collegato a un Arduino tramite Alexa e l'IoT Cloud. Quando connetto il dispositivo all'alimentazione e provo a dire 'Alexa, accendi la luce', c'è un notevole ritardo prima che il pin venga attivato. Tuttavia, una volta attivato, risponde ad altri comandi alla velocità normale. Esiste un modo per accelerare questa risposta? Oppure, come posso determinare quando il dispositivo è pronto per ricevere l'input? Attualmente, ho utilizzato un LED che si attiva quando il programma entra nella funzione loop, ma non sembra essere sufficiente. Avete qualche consiglio?
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/fcf7d449-a7d0-4737-bacd-b66806fa8660
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
CloudLight luce;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
int led = 2;
int led1 = 3;
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
pinMode(led1, OUTPUT);
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
pinMode(led, OUTPUT);
}
void loop() {
ArduinoCloud.update();
// Your code here
digitalWrite(led1, HIGH);
}
/*
Since Luce is READ_WRITE variable, onLuceChange() is
executed every time a new value is received from IoT Cloud.
*/
void onLuceChange() {
// Add your code here to act upon Luce change
digitalWrite(led, luce);
}