Workbench projects


#1

Hi all, bit of a newb question here, are workbench projects designed to be for a single device or can I have multiple devices in a project with different programs? I have a few devices that I want to setup around the house and would like to keep it all in one project if I could.

Thanks


#2

You can change the Target ‘Configure for device’ before you compile and Flash. Suggest you have a play.


#3

And you can use directives in the code to section out some code based on the target device you select as @armor says.

#if PLATFORM_ID == PLATFORM_ARGON

    WiFi.on();
    WiFi.connect();
    if (waitFor(WiFi.ready, 60000))
    {
        Serial.printf(tempMsg, sizeOfMessageText, "%s", str_wifiReady);
        netActive = NET_WIFI;
        showWiFi();
    }

#elif PLATFORM_ID == PLATFORM_BORON // BORON

    // Do cellular stuff here ....
    netActive = NET_GSM;

#endif

#4

I was aware of that I just didn’t know if it would try to compile and send everything to a single device. Like if I make a .cpp file for three different devices you know what I mean.


#5

One way for you to be sure is to compile and do a local flash (via USB) to a device in DFU mode. It is always a good idea to have a confirmation of the software version flashed e.g. Serial.print() or Particle.variable.


#6

I guess what you are after is called Multi-Root Workspace and that should be supported in Workbench too


#7

Wooow haha. I think maybe I’ll start pretty simple haha :slight_smile:

Thanks everyone for the answers, much appreciated.