void setup() {
// Start serial communication
Serial.begin(9600);
while (!Serial); // Wait for the serial port to connect (for certain boards like ESP32)
Serial.println("I am in setup");
// Wait for 2 seconds before entering the loop
delay(2000);
}
void loop() {
// Print "Loop 1000" and wait for 1 second (1000 ms)
Serial.println("Loop 1000");
delay(1000);
// Print "Loop 2000" and wait for 2 seconds (2000 ms)
Serial.println("Loop 2000");
delay(2000);
// After 2000ms, exit the loop and go back to setup
Serial.println("Exit loop, go back to setup");
// Call setup() again (this is not typical, but for this case, we simulate a "restart")
setup();
// The loop will not run again until the system resets.
}