Buenas tardes gente, alguien podría ayudarme por favor; llevo todo el día tratando de utilizar el ESP-01 con el módulo de relé pero se me ha hecho imposible, lo he querido utilizar con arduino cloud por más fácil y poder accionar el relé desde cualquier parte desde mi celular, pero cuando cargo el código al esp-01 este hay veces conecta a mi wifi y hay veces que no, ahorita por ejemplo más bien me la bota la red xD, a continuación les copio el código que estoy utilizando:
#include "arduino_secrets.h"
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/65a4bece-4f9d-4ee1-b776-477f4b5a7f12
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
bool relay;
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"
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);
pinMode(0, OUTPUT);
// Defined in thingProperties.h
initProperties();
// 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();
}
void loop() {
ArduinoCloud.update();
// Your code here
}
/*
Since Relay is READ_WRITE variable, onRelayChange() is
executed every time a new value is received from IoT Cloud.
*/
void onRelayChange() {
if(relay){
digitalWrite(0, HIGH);
}
else{
digitalWrite(0,LOW);
}
// Add your code here to act upon Relay change
}
El código que he pegado ha sido tomado del siguiente video tutorial
https://www.youtube.com/watch?v=lGsFOYyZ0Dc&t=214s, solo he cambiado los valores propios correspondiente a mi caso.