Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Setup or not

Hello all,

I am moving from the Arduino Uno to the nRF52 DK on Segger. A big difference Slight smile

When looking at the examples, I cannot see the so-called setup() method, so, I am wondering, where is it or is it not the subject here?

Any explanation is very appreciated.

Thanks.

Parents
  • Hi,

    The setup()/loop() architecture is Arduino-specific consept. 

    In embedded C programming, you normally have a main() function, which is run at application start.

    Inside main(), you first do the setup/initialization of things happening when the application starts (similar to what you would put in setup() in your Arduino application), then you put a endless while loop after that, where you put whatever the application should do for the rest of the runtime (similar to what you would put in loop() in Arduino).

    Note that typical nRF5 applications are based on using event/interrupts/callback architecture, which is configured on startup. The main loop is typically used to process/complete actions triggered by events/interrupt, and otherwise put the device in sleep mode.

    Best regards,
    Jørgen

Reply
  • Hi,

    The setup()/loop() architecture is Arduino-specific consept. 

    In embedded C programming, you normally have a main() function, which is run at application start.

    Inside main(), you first do the setup/initialization of things happening when the application starts (similar to what you would put in setup() in your Arduino application), then you put a endless while loop after that, where you put whatever the application should do for the rest of the runtime (similar to what you would put in loop() in Arduino).

    Note that typical nRF5 applications are based on using event/interrupts/callback architecture, which is configured on startup. The main loop is typically used to process/complete actions triggered by events/interrupt, and otherwise put the device in sleep mode.

    Best regards,
    Jørgen

Children
Related