Control Photon before setup() [SOLVED]

In user firmware, is there a way to get a chance to setup() BEFORE connecting to the internet?

The reason I ask is, at powerup, I want to set the I/O pins to a ‘safe state’ regardless of internet availability.

And I really don’t want to flash custom system firmware.

Yes. Use SYSTEM_MODE(SEMI_AUTOMATIC);
This is covered in the documentation (http://docs.particle.io/photon/firmware/). Specifying this at the head of your source code file will result in Setup() being run immediately, without connecting to the Internet and cloud. After initializing the I/O pins, call Spark.connect(). Voila…

@steelydev, @WebDust21 is absolutely correct. However, there are certain pins affected during the boot sequence having to do with JTAG. This is documented but the Photon documentation is undergoing repairs right now.

1 Like

That was easy! You can’t learn this stuff overnight…it takes years!

How do you add [Solved] to the thread?

@steelydev, done!