Skip to main content
The BOOM
Associate III
January 24, 2021
Question

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

  • January 24, 2021
  • 1 reply
  • 571 views

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

    This topic has been closed for replies.

    1 reply

    Uwe Bonnes
    Chief
    January 24, 2021

    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.