¡Tu solución está lista!
Nuestra ayuda de expertos desglosó tu problema en una solución confiable y fácil de entender.
Mira la respuestaMira la respuesta done loadingPregunta: Hi!! Thank you in advance for your time and your response :) My question is, for the following arduino code, do I need a relay? And if the answer is yes, what part of the code does the relay help with? const int sensorHumedadPin = A0;const int bombaAguaPin = 8;const float pendiente = 399.6;const float interseccion = 123;const int umbralBomba = 50;void
Hi!! Thank you in advance for your time and your response :) My question is, for the following arduino code, do I need a relay? And if the answer is yes, what part of the code does the relay help with?
const int sensorHumedadPin = A0;
const int bombaAguaPin = 8;
const float pendiente = 399.6;
const float interseccion = 123;
const int umbralBomba = 50;
void setup() {
pinMode(sensorHumedadPin, INPUT);
pinMode(bombaAguaPin, OUTPUT);
digitalWrite(bombaAguaPin, LOW);
Serial.begin(9600);
}
void loop() {
int lecturaHumedad = analogRead(sensorHumedadPin);
int tiempoActivacion = constrain((lecturaHumedad * pendiente) + interseccion, 0, 2000);
Serial.print("Humedad: ");
Serial.print(lecturaHumedad);
Serial.print(", Tiempo de Activación: ");
Serial.print(tiempoActivacion);
if(lecturaHumedad < umbralBomba) {
activarBomba(tiempoActivacion);
}
delay(15000);
}
void activarBomba(int tiempoActivacion) {
digitalWrite(bombaAguaPin, HIGH);
delay(tiempoActivacion);
digitalWrite(bombaAguaPin, LOW);
}- Queda solo un paso para resolver este problema.Solución100% (1 calificación)Paso 1Mira la respuesta completaRespuesta
Answer:
The need for a relay in your Arduino setup depends on the type of device you’re controlling w...
Desbloquea
Estudia mejor, ¡ahora en español!
Entiende todos los problemas con explicaciones al instante y pasos fáciles de aprender de la mano de expertos reales.