How to Run Program from CLI?

I’ve taken a look at the guide and forums and can’t find anything. Does anyone know if we can use the CLI to run the program that’s uploaded. I’d love to speed up testing vs having to wait 90 seconds for my LTE to connect every time.

If you mean whether there is an “emulator” to run the firmware on a computer then no.

The usefulness of such an emulator would also be limited IMO.
The most trivial projects would typically not require too many iterations to get running while the less trivial ones (using external circuitry and/or interaction with external data sources/sinks) would either not be able to test all the facets or require extensive rigging-up effort to emulate that infrastructure too.

@LADD You may want to include SYSTEM_THREAD(ENABLE) in your code to allow the user code to run immediately on startup. You can also use SYSTEM_MODE(SEMI_AUTOMATIC) to keep the cloud connection OFF until you run Particle.connect().


Not necessarily an emulator. More like a way to trigger a function to start inside of the program. Right now I trigger the function via google sheets, to IFTTT to the particle. I’d like to be able to just type “Run Function …” into the CLI for testing purposes.

You can use Particle CLI to call cloud functions on a device with particle call.

If you’re looking to communicate directly with the device you could parse commands over serial.

1 Like

I’ve tried various formats and still can’t figure out the structure. The examples given don’t really provide enough information.
If my device is named (Boron) and function is called “switch” I would think the command would be:

particle call Boron switch

but that doesn’t work…it talks about id and products but doesn’t say or gives an example of where it comes from.

What exactly does it say?

(You should make sure that you are signed into Particle CLI. You can login with: particle login)

If you use particle help call, you can get help information about the call command:

particle help call
Call a particular function on a device
Usage: particle call [options] <device> <function> [argument]

Global Options:
  -v, --verbose  Increases how much logging to display                   [count]
  -q, --quiet    Decreases how much logging to display                   [count]

  --product  Target a device within the given Product ID or Slug        [string]

  particle call coffee brew                 Call the `brew` function on the
                                            `coffee` device
  particle call board digitalWrite D7=HIGH  Call the `digitalWrite` function
                                            with argument `D7=HIGH` on the
                                            `board` device
  particle call 0123456789abcdef01234567    Call the `brew` function on the
  brew --product 12345                      device with id
                                            `0123456789abcdef01234567` within
                                            product `12345`
1 Like