Implemented the RCWL-1601 ultrasonic distance sensor and the ESP32-C3’s internal temperature sensor to measure distance with temperature compensation. I first configured the GPIO pins to trigger the RCWL-1601 and measured the echo pulse duration using high-precision counters from hal/cpu_hal.h. The measured pulse width was then converted into distance by calculating the speed of sound as a function of temperature using the formula v=331.4+0.6T, where T is the temperature in Celsius. The ESP32’s built-in temperature sensor provided real-time temperature readings within the range of 0°C to 50°C, which were used to dynamically adjust the speed of sound and improve distance accuracy. The program printed both the temperature and distance to the serial monitor once per second in the format “Distance: X cm at Y°C.” After calibration, the system consistently measured distances between 10 and 20 cm with less than a 2 cm error.