const int Water_Sensor_Power_Output = 5; //connected to sensor's VCC pin to turns on the sensor prior to reading
const int Water_Sensor_Data_AD_Input = 39; // ESP32 pin GIOP39 (ADC0) connected to sensor's signal pin
const int RELAY_1_Output = 16;
const int RELAY_2_Output = 17;
const int LED_BuiltIn_Output = 23;
const int hallSensors[] = {4,13,14,18,19,21,22,25,26,27,32,33};
boolean hallPositions[] = {LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW};
void setupPinModes() {
// pinMode(RELAY_1_Output, OUTPUT);
// pinMode(RELAY_2_Output, OUTPUT);
// pinMode(Water_Sensor_Power_Output, OUTPUT);
// pinMode(LED_BuiltIn_Output, OUTPUT);
for (int i = 0; i < 12; i++) {
pinMode(hallSensors[i], INPUT_PULLUP);
}
}
void readHallSensors()
{
for (int i = 0; i < 12; i++) {
hallPositions[i] = !digitalRead(hallSensors[i]);
}
}
void printHallSensorsPositions()
{
for (int i = 0; i < 12; i++) {
Serial.print(hallPositions[i]);
Serial.print(" ");
}
}
void setup()
{
Serial.begin(115200);
Serial.println();
setupPinModes();
//readPositionsState();
}
void loop() {
readHallSensors();
printHallSensorsPositions();
Serial.println();
delay(1000);
}