Define The Pins For The Ultrasonic
Define The Pins For The Ultrasonic
void setup() {
// Start the serial communication at 115200 baud rate
Serial.begin(115200);
void loop() {
// Send a 10-microsecond HIGH pulse to trigger the sensor
digitalWrite(triggerPin, LOW); // Ensure the trigger pin is LOW initially
delayMicroseconds(2); // Wait for a short time
digitalWrite(triggerPin, HIGH); // Send a trigger pulse
delayMicroseconds(10); // Wait for 10 microseconds
digitalWrite(triggerPin, LOW); // End the trigger pulse
LDR:
void setup() {
// Start the serial communication at 115200 baud rate
Serial.begin(115200);
void loop() {
// Read the analog value from the LDR (0 to 4095 for 12-bit ADC on ESP32)
ldrValue = analogRead(ldrPin);
void setup() {
// Start the serial communication at 115200 baud rate (recommended for ESP32)
Serial.begin(115200);
void loop() {
// Read the analog value from the temperature sensor (LM35)
int sensorValue = analogRead(sensorPin);