This guide will walk you step-by-step through the basic functionality of the Bean command-line-interface (CLI). When you are done reading this guide you will have:
If you are looking for an exhaustive reference for the commands available in the CLI please see here.
We also recommend reading the separate Bean SDK/CLI Overview to get a better understanding of this project!
Follow the install guide for your system:
Open a terminal of your choice and get ready! (iTerm2, terminal, cmd.exe, PowerShell, etc).
First, let's start scanning for Beans using the
We see there is a new LightBlue device discovered, with some basic information about it, including the important Address.
To ensure that this is the Bean we are interested in, let's blink the on-board LED. Most commands require an
name to identify the Bean of interest. We strongly recommend using the
address to avoid name conflicts. The syntax works like this:
bean <command> --address <address>
Or shorthand address:
bean <command> -a <address>
See it in action!
Ok! It looks like we have the correct address for the Bean we are interested in, let's move on.
This step ensures the Bean has the latest and greatest firmware. Although not always required for all Bean interactions it's never a bad idea and certain functionality wont work if the Bean isn't up to date!
Updating the firmware is as simple as blinking an LED, using the
And eventually, after a few reboots...
Next, we must "associate" our CLI loader with the Arduino app on your system, similar to hitting cmd+A using the OS X loader. The command we will use for this is called
This command will prompt you to enter the path to the Arduino install folder. Examples include:
Windows: C:\Program Files (x86)\Arduino\
Compiling sketches works similar to the OS X Loader, although programing/uploading the Bean is done through the CLI.
First, open your Arduino app and make sure of two things:
Next, open up a sketch of your choosing. For the sake of this guide it is probably easiest to open an example sketch located in the File menu. Make sure you choose a "LightBlue Bean" sketch (which compile for both Bean and Bean+).
With your sketch opened, click "Upload" in the Arduino IDE. This compiles the sketch and puts it somewhere where the CLI Loader can access it.
Note: This step requires
python to be on your system path! This should already be done since the install process also requires Python 2.7.* on the path.
Finally we are ready to upload the sketch.
First, we can view any compiled sketches from the previous step, or anytime in the past using the command
As you can see here, we have many sketches compiled and available for uploading. Let's choose one and upload it using the
The log output is somewhat chatty, which we will be improving upon.
And after some time...