Introduction: Marco Polo • Pinoccio Scout Camp, Day 1

About: Former Artist in Residence at Instructables, currently Hacker Advocate at Hackster. Cofounder of ProtoTank, a hardware prototyping startup. FIRST kid (rock on, team 677!). Former board member at AHA (Ann Arbor…

Pinoccio pictured with assistant Chester

Hey there! This is a starter project that should help you break the ice with your Pinoccio Scouts. (I built it at TechShop SF.)

Pinoccio is a new, open-source kit for your own personal Internet of Things. It's like an Arduino Mega that does wireless mesh networking out of the box - and comes with its own rechargeable battery!

We call our little boards Scouts: a basic Field Scout can talk to all the others in its Troop via radio, and a Lead Scout is one of those, but wearing a WiFi "backpack" that connects up its entire Troop (mesh network) to the internet.

Okay, that should be all the lingo you need. On to the game: this one, designed to test the range of the radio link, requires no extra components and is a perfect starting point for working with Pinoccio.

Step 1: Materials

This game requires a Lead Scout and a Field Scout, which is what you get in a Starter Kit.

You'll also need the Micro-USB cable that came with your kit (which is the same as a standard Android charging cable).

If you want, you can grab a couple of LEDs to throw on the Field Scout, which will be acting as a light-up beacon.

You will also need a friend, or friendly robot, in order to play this game. It may be necessary to ply them with treats. Better yet, get them to hang out and build with you!

Step 2: Troop Bonding

First, set these little fellows up as a Troop. Log into HQ, click "New Troop" at bottom-left, and follow the directions to name your Troop and your Lead Scout.

Once that one's set up, click "Add a Scout" under the Troop's name in the left sidebar, and follow those steps to completion.

I won't go into the whole process here, but we'll be adding it to our documentation, so that you can get a feel for it even if your Pinoccio hasn't shipped yet.

Step 3: Game Rules

Time to teach your Scouts the game! In HQ, open up your Field Scout and enter this into the Console:
function blaze { led.torch; delay(1000); led.off; }
This means:
When I type blaze in the Console, turn the main LED on to its torch color. Then, wait 1000 milliseconds (1 second). At that point, turn the LED off.

If you're only going to use the main LED, that's all you need! But I think it's a little more fun if you add one or two more. So, pull out your extra(s) and plug them in.

Adding LEDs

The long leg (positive) for one LED goes into digital pin 2.
The positive leg of the other LED goes into digital pin 4.
The short legs get connected to ground, which means that you can just plug one into the "GND" socket and then twist the other short leg around it, as shown above.

Now, we need to tell the Scout to play with these as well as the main LED. Enter this function into the console to save it over your previous version, or choose a new name and keep both:
function blaze { led.torch; pin.write("d2", HIGH); pin.write("d4", HIGH); delay(1000); led.off; pin.write("d2", LOW); pin.write("d4", LOW); }
This uses the write command, which changes the value of the pin: pin.write("d2", HIGH); means, "Write value HIGH (On) to digital pin 2 (one of our LEDs)."

There's one final piece of the puzzle, which is only needed if you've got these extra LEDs plugged in. The Scout needs to know in advance that it's going to be using those pins, but it's forgetful: it will remember your functions until you erase them, but you have to initialize the pins every time it wakes up. So, enter this function:
function startup { pin.makeoutput("d2"); pin.write("d2", LOW); pin.makeoutput("d4"); pin.write("d4", LOW); };
Once you've defined it, any function called startup will run every time the Scout is powered on. This one says: Every time you wake up, set pin 2 as an output - since that pin will be sending information into the world, instead of receiving it, like a sensor would. Then, make sure it's off. Afterwards, do the same for pin 4.

That's all! Time to play.

Step 4: Let's Go!

Grab your trusty friend* and instruct them thus:
  1. You are going to type blaze into the HQ Console. At that point, you must yell "Marco!" (or, if you prefer, "Ping!")
  2. At that point, the beacon will light up, and your friend should respond, "Polo!" (or "Pong!")
  3. They should start near you, then move away until the beacon stops responding.
You've just found the radio range for your environment! You can use this as a test, if you're mapping out a project but aren't sure if there's too much stuff between your Scouts, like walls and distance.

If you play in the dark, it's like an actual game of Marco Polo: you'll only be able to locate your friend when you trigger the beacon to light up.
See what happens if they go around a corner, or jump behind another group of people, or bury the Scout under a pile of cushy pillows.

The final step is to send us pictures. Lots and lots of pictures. You'll be FAMOUS.**

* Hopefully, you have chosen a friend who won't just run off with your Pinoccio. Time to find out!
** You might not actually be famous... but do send us things, or drop us a line, at hello@pinocc.io :)