Boron running some code on startup

Hello,

Most of my code is intended to work after the Boron is connected to the cloud. However, there are some cruccial instructions (to declare some pins as output HIGH or LOW) that I would like to execute as fast as possible, on startup, before it tries to connect to the network.

Is this possible? How is it done?

Cheers.

The STARTUP() macro is used for that.

https://docs.particle.io/reference/device-os/firmware/boron/#startup-

If you have multiple things to do, create a function and call that function from the STARTUP macro. There are limited things you can do from STARTUP, but setting pinMode and digitalWrite are safe and a common use-case.

1 Like

I knew I had read something about that I just didnt know how to get back. Thanks!