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