#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = “YourWiFi”;
const char* password = “YourPassword”;
int pumpPin[8] = {13, 12, 14, 27, 26, 25, 33, 32};
int sensorPin[8] = {34, 35, 36, 39, 4, 2, 15, 19};
int threshold = 40;
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(“.”);
}
Serial.println(“WiFi Connected”);
for (int i = 0; i < 8; i++) {
pinMode(pumpPin[i], OUTPUT);
digitalWrite(pumpPin[i], LOW);
}
}
void loop() {
for (int i = 0; i < 8; i++) {
int value = analogRead(sensorPin[i]);
int percent = map(value, 4095, 0, 0, 100);
if (percent < threshold) {
digitalWrite(pumpPin[i], HIGH);
} else {
digitalWrite(pumpPin[i], LOW);
}
Serial.printf(“Pasu %d: %d%%\n”, i+1, percent);
}
delay(5000);
}