- Getting Started
- Welcome to Bean!
- Technical Specs
- Regulatory Info
- Bean Loader for OS X
- Bean Loader for Android
- Bean Loader for iOS
- Bean Loader for Windows
- Bean Loader for Linux
- CLI Loader
- Feature Walkthroughs
- Battery Functions
- Grove Modules
- PIN Code Security
- Power Management
- Scratch Characteristics
- Temperature Sensor
- Virtual Serial
- Node.js SDK/CLI
- Install on OS X
- Install on Windows
- Install on Linux
- Install on Raspberry Pi
- BLE Dongle Setup
- CLI Reference
- Building an App
- Everything Else
- Downloads and SDKs
- Prototype to Production
- Hardware Files
- Hackathons and Meetups
- Resources for Educators
- LightBlue Demo Sketch
- How GAP and GATT Work
- Having Problems?
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:
- Scanned for Beans
- Located the Bean you are interested in
- Compiled a Sketch
- Uploaded the Sketch
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!
Before you begin
Follow the install guide for your system:
Open a terminal of your choice and get ready! (iTerm2, terminal, cmd.exe, PowerShell, etc).
Scan and Locate
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.
Important: Update Bean Firmware
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…
Associate With Arduino
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:
- The correct Board is chosen under the Tools menu. The only two valid options for LightBlue devices are Bean and Bean+.
- The correct Programmer is selected under the Tools menu.
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…