Arduino - running setup all the time


I run a sketch on my Arduino UNO and realized that it runs the SETUP(), then the VOID LOOP() and while running randomly goes back to run the SETUP() again randomly but continues aterwards in the loop.

It does the same on my second Arduino UNO. Is there a configuration I don't know ?

In the serial Monitor I can see all the messages after Serial.begin(9600); in the SETUP part.

I previously uesd the Arduino UNO to load sketches on an Arduino NANO using the UNO as SPI. Can that be a reason ?

Many thanks


It sounds like the board is resetting.
How is it powered, what is connected to it ?

Please post your code that exhibits this behavior

Your Arduino may be reset. You should check the RESET pin. Make sure that it is not connected to anything.

If the reset pin was in the reset state then the Arduino would not run setup().


void setup()
  pinMode(PinModus, INPUT_PULLUP); 
  pinMode(PinSet, INPUT_PULLUP); 

  Modus = 0;

  R = 225 ; 
  G = 195 ;
  B = 70 ;

  pixels.setBrightness( 200 )  ;
  pixels.clear() ;
  HellegkeetModus = 10;

  LiesRTC () ;

That's not a complete sketch.

Check you sketch for writing data outside the bounds of an array, and avoid the use of String variables.


I forgot to declare a pin as input. Since i corrected this, all runs fine.

Thanks for all

I forgot to declare a pin as input.

Pins default to inputs though....