cancel
Showing results for 
Search instead for 
Did you mean: 

Are init() and Serial.flush() required in main()?

The BOOM
Associate III

This page says:

With a custom main() on Arduino:

Call init() if you want to use things like millis(), micros(), and delay(), because that is where the hardware timers get initialized. This will also affect analogRead(), analogWrite(), and a few other things. Unless you know what you are doing, it is best to call init().

Call Serial.flush() if you have been doing serial printing, otherwise interrupts will be turned off and the most recent serial prints may not be shown.

Do these tips also apply to STM32 chips?

Thx

1 REPLY 1
Uwe Bonnes
Principal III

These tipps apply to arduino. So if you use arduino , you have to follow the arduino rules, no matter if STM32,AVR or what else.