Loading
Loading
IoT Lab content is currently available in Arabic only. We're working on an English version.
عرض بالعربية →How to pump water automatically based on a soil moisture sensor.
Use a relay to cut the positive wire of the pump. Connect the relay and Arduino to a shared GND if using two power sources.
const int pumpPin = 7;
void setup() {
pinMode(pumpPin, OUTPUT);
}
void loop() {
digitalWrite(pumpPin, HIGH); // تشغيل المضخة
delay(3000); // ضخ الماء لـ 3 ثوانٍ
digitalWrite(pumpPin, LOW);
delay(10000);
}Running the pump in air (without submerging it in water), which quickly damages the internal impeller due to thermal friction.