// Pin definitions for your sensors
#define PRESSURE_SENSOR_PIN 32 // ESP32 pin connected to pressure sensor (potentiometer)
#define VOLTAGE_SENSOR_PIN 34 // ESP34 pin connected to voltage sensor (potentiometer)
// Variables to store sensor values
int pressureValue = 0;
int voltageValue = 0;
void setup() {
// Initialize serial communication for debugging
Serial.begin(115200);
// Print a welcome message
Serial.println("Hello, ESP32!");
// Additional setup code can be added here if necessary
}
void loop() {
// Read the analog values from the sensors
pressureValue = analogRead(PRESSURE_SENSOR_PIN); // Read value from pressure sensor
voltageValue = analogRead(VOLTAGE_SENSOR_PIN); // Read value from voltage sensor
// Optionally, map the sensor readings to a more meaningful range
// For example, if you expect the sensors to read values between 0-1023 (10-bit ADC)
// you can map them to a specific range (like 0-100 for pressure/voltage percentage)
int mappedPressureValue = map(pressureValue, 0, 4095, 0, 100); // Map to 0-100%
int mappedVoltageValue = map(voltageValue, 0, 4095, 0, 100); // Map to 0-100%
// Print the values to the Serial Monitor for debugging
Serial.print("Pressure Sensor Value: ");
Serial.print(mappedPressureValue);
Serial.print("% | Voltage Sensor Value: ");
Serial.print(mappedVoltageValue);
Serial.println("%");
// Add a small delay before reading again
delay(500); // Delay for 500ms
// The delay(10) from your original code can be kept here to speed up the simulation
delay(10); // This speeds up the simulation
}