Skip to content

Creating a New Troop via the CLI

jingman edited this page Sep 8, 2014 · 3 revisions

Create a new Troop and its first Scout

Log in with your Pinoccio credentials. If you don't have an account, you can create one at pinocc.io.

pinoccio login

Create a new Troop and make note of the token and id it returns - you'll need them later (we'll reference them as TROOP_ID and TROOP_TOKEN from now on).

pinoccio rest post v1/troop --name "Sesame Street"

Create a new Scout for this Troop and make note of the id it returns (it will be 1 if this is the first Scout you're adding to this Troop). We'll reference it as SCOUT_ID from now on.

pinoccio rest post v1/TROOP_ID/scout --name "Big Bird"

Configure the Scout

Plug in and turn on your Scout (if you haven't already), and connect to its ScoutScript shell:

pinoccio serial

You should see a "Hello Pinoccio" prompt. Now we're going to configure your Scout using the info for your new Troop and Scout. Each line here is a command.

Note: You can make MESH_KEY any string between 0 and 16 characters. When you provision via HQ, we just use the last 16 characters of your TROOP_TOKEN.

hq.settoken(TROOP_TOKEN);
mesh.config(SCOUT_ID, TROOP_ID, 20);
mesh.setkey(MESH_KEY);

Close the serial connection to the Scout with ctrl+c

Connect the Scout to HQ

The Troop won't show up in HQ until a Scout from the Troop has been connected to the server. We can do that with Bridge Mode.

pinoccio bridge -v

That should connect your Scout (and its Troop) to the Pinoccio server, and you'll see it show up the next time you refresh HQ.