// ESP32 Random Number Generation and Serial Output
void setup() {
// Begin serial communication at a specified baud rate
Serial.begin(9600);
}
void loop() {
// Initialize min and max values
int minVal = 0;
int maxVal = 10;
// Perform the task for 20 iterations
for (int i = 0; i < 20; i++) {
// Generate a random number within the current min and max limits
int randomNumber = random(minVal, maxVal);
// Print the randomly generated number on the serial monitor
Serial.println(randomNumber);
// Update min and max values for the next iteration
minVal = maxVal;
maxVal += 10;
// Add a delay for better readability (optional)
delay(500);
}
// End the program after 20 iterations
while (true) {
delay(1000);
}
}