Joint Argon (wifi) / Boron (GSM) compatibility

To make the same program work on Argon/Boron, I need to comment out either

Cellular.setActiveSim(EXTERNAL_SIM); Cellular.setCredentials("myrpovider"); if (!waitFor(Cellular.ready, 300000)) System.reset(); waitUntil(Particle.connected); //takes some time until 3G connection setup Particle.keepAlive(120);

or

WiFi.setCredentials("SSID", "PWD", WPA2); if (!waitFor(WiFi.ready, 300000)) System.reset(); waitUntil(Particle.connected); //takes some time until 3G connection setup Particle.keepAlive(20);

Is there a way to detect whether either wifi or cellular class is already declared, so that the same source code can be reused for both type of processors Argon (Wifi) AND boron(GSM)?

For best results, don't check for a specific platform, but instead check for a features, in particular Wiring_Cellular and Wiring_WiFi.

thank you. Embedding the code in the #if preprocessor directive works perfectly

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.