Introduction: Install Particle CLI : Photon, Core

After writing up multiple instructables on the Particle core, I decided to write up an instructable on how to install and use the Particle CLI. The particle CLI is a command line or terminal application that makes working with your spark core a lot easier. Particle CLI is a node.js application.

Using the particle CLI you can, Claim a core or a photon, flash it and call functions, monitor variables and a lot more.

Here's what particle has to say -

"The Particle CLI is a powerful tool for interacting with your devices and the Particle Cloud. The CLI usesnode.js and can easily run on Windows, Mac OS X, and Linux. It's also open source so you can edit and change it, and even send in your changes as pull requests if you want to share!".

So lets get started....

Step 1: Node.js

This application is based on node.js and you require npm to install it. You can download node.js form the node.js offical website.

Node.js is available in multiple packages for different OS and choose the package that suites your OS. after installing you should be able to access node.js by typing in "node" in the terminal or command line. This will start a different prompt that looks more like the one python has. You can exit the prompt by clicking ctrl + D.

Step 2: Installing Particle CLI

After installing node.js you should now have npm installed, type in the following commands to install it.

$ npm install -g particle-cli

This would install the particle -cli, this is all that you had to do now you need to login to get connected to particle cloud.

$ particle login

You can update your particle CLI by typing

$ npm update -g particle-cli 

Step 3: Claiming a Core

You can claim a core or a photon using the spark CLI and it is the fastest way to do it.

Connected your core make sure it is blinking blue, and type in the following command in the terminal

$ particle setup

Follow the instructions displayed on the screen, you have to have a WiFi network to connect to while doing this.

Step 4: Flashing Tinker

You can run

$ particle help

to get the various commands related to the CLI.

You can also flash tinker the default application of the core or photon by typing in

$ particle flash my_new_device_name tinker

and to log out of Particle CLI all you have to do is type in

$ particle logout

Comments

author
GarethT1 (author)2016-03-16

really helpful. Thanks

author
OspreyGozo (author)2015-09-25

When I enter "$ npm install -g particle-cli" I get this:

SyntaxError: Unexpected identifier
at Object.exports.createScript (vm.js:44:10)
at REPLServer.defaultEval (repl.js:117:23)
at bound (domain.js:254:14)
at REPLServer.runBound [as eval] (domain.js:267:12)
at REPLServer.<anonymous> (repl.js:279:12)
at REPLServer.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:214:10)
at REPLServer.Interface._line (readline.js:553:8)
at REPLServer.Interface._ttyWrite (readline.js:830:14)
at ReadStream.onkeypress (readline.js:109:10)

I installed Node.js and I am running it from a Windows 7 command prompt (after running "node" of course). The Spark Core is in DFU mode (flashing yellow).

About This Instructable

6,939views

15favorites

License:

Bio: Hi, I just launched an Indigogo campaign support my projects by backing it. https://www.indiegogo.com/projects/tinker-usb-a-wifi-based-badusb#/
More by ThisIsSteve:Linkit One Text to SpeechLinkit One Kitchen TimerIntel Edison Talks to Linkit One
Add instructable to: