// Constants of the number of sensors
const int numSensors = 4; // Number of sensors
int sensorPins[numSensors] = {A0, A1, A2, A3}; // Array pins array
int sensorValues[numSensors]; // Array to store sensor values
void setup() {
Serial.begin(9600); // Initialize serial communication
for (int i = 0; i < numSensors; i++) {
pinMode(sensorPins[i], INPUT); // Set sensor pins as input
}
}
void loop() {
// Read sensor values
for (int i = 0; i < numSensors; i++) {
sensorValues[i] = analogRead(sensorPins[i]);
}
// Display sensor values
for (int i = 0; i < numSensors; i++) {
String sensorData = "Sensor " + String(i) + " : " + String(sensorValues[i]);
Serial.println(sensorData); // Print sensor data string
}
delay(1000); // Delay to avoid flooding the serial monitor
}