Get familiar with Rockpool, our super-simple programming tool.

Materials Used

  1. Raspberry Pi 2 or 3 model B
  2. 5v/2A+ micro USB power supply
  3. HDMI-capable display, or official Raspberry Pi display
  4. USB keyboard
  5. USB mouse
  6. Wifi dongle or ethernet cable
  7. Micro SD card 8GB+
  8. Flotilla dock
  9. Red USB cable
  10. Short blue Flotilla ropes x2
  11. Rainbow module
  12. Touch module

In this guide to Rockpool, we'll introduce you to Rockpool and get you familiar with how it works with a couple of simple exercises.

If you haven't already followed our installation tutorial, to get your dock set up and the Flotilla software installed, we'd suggest that you do that now.

Rockpool is our really easy way to get started with Flotilla. It lets you link together inputs and outputs, and modify them on the way, if you like.

Each rule in Rockpool has an input on the left hand side and an output on the right. Modifiers go in the middle, and let you change the way the input feeds through to the output.

Rockpool empty

Inputs and outputs that are connected are displayed as one of eight little grey dots at the bottom left or bottom right of the screen.

You can add several of these rules, to have them all working at the same time, and even link them together with the modifiers.

Each rule can be toggled on or off, or deleted if you no longer need it.

Adding, removing and modifying rules

You'll see that Rockpool has started up with one rule, a virtual 50% input.

This rule is switched on when you first open Rockpool. Notice that it says "on" at the left hand side of the line.

If you click where it says "on", then that rule will switch off.

Rockpool rule off

You'll also see that a red "x" has appeared at the right hand side of the rule. Clicking on that red "x" will remove that rule from Rockpool

Now, we'll add a new rule back in.

Click on the big "+" icon on the left hand side below where it says "input".

Rockpool inputs

In the blue box that appears at the bottom, you'll see a number of virtual inputs. The Flotilla input modules appear in the grey box above, when they are plugged in.

We're going to select "wave" and then "medium" in the dialog box that pops up.

Rockpool sine medium

You should now have a new rule in Rockpool that is showing a wave cycling through values between 0 and 1000.

Rockpool sine display

To change a rule, for instance to change the input type, we don't have to delete it and add a new one, we can just change the existing one by clicking on the input (the leftmost circle).

A little dialog box will pop up with options to modify the existing input or, by clicking on "change", you can change to a completely different input.

Try changing your medium sine wave to a fast square wave.

Rockpool rule change

Inputs

Inputs can be a Flotilla module like slider, dial, motion, touch, etc, or they can be one of a number of virtual inputs that can be a percentage value, a time, a random number, a sine or square wave, a keyboard key or a variable.

Most of the inputs generate a number that is between 0 and 1000, as you'll see from the 500 value produced by the virtual 50% input.

We'll begin by looking at Flotilla input modules and how they work.

Flotilla input modules

The Flotilla input modules are:

  • touch
  • motion
  • slider
  • dial
  • light
  • joystick
  • colour
  • weather

The touch, slider, dial and joystick modules all require you to interact with them to produce a signal. The others - motion, light, colour and weather - are sensors that will just produce an output without any interaction from you.

First, we'll look at the touch module, which comes with all of the Flotilla kits.

The touch module

Touch has four touch-sensitive pads, numbered 1-4, that produce a signal when you touch them. That means that you can have each of the four buttons do a different thing. Handy! It also has four little LED lights that light up when you touch a numbered pad.

Plug your touch module into port 1 on the dock with one of the short blue Flotilla ropes now.

You should see that the first of the eight little blue dots on the input side has changed from blue to grey, indicating that an input module is plugged into port 1 on your dock.

Rockpool input detected

If you still have that fast sine wave virtual input there, then just click on it and then on "change" to replace it. If not, then click the large "+" icon on the input side to add a module.

You should see a touch module in port 1. Click on it.

Touch module icon

In the dialog box that appears, we're going to click "one" to add a rule for touch input one.

Touch module dialog

Now we've added a rule that will respond when we touch input one.

Try it now: touch and hold pad one and watch what happens to your line. You should see the output toggle to 1000. Now take your finger off pad one again and watch the output drop to 0.

Modifiers

Modifiers change inputs on their way to becoming outputs. They can also be used to add together different inputs.

The three circles between the input and output circles on each side are where you add modifiers.

We're going to add an invert modifier and see what it does to our rule for touch input one.

Click on the second circle from the left on your touch input one rule.

Rockpool modifiers

Click on the "invert" icon to add an invert modifier.

Now try touching pad one again and see what effect the invert modifier has had.

We'll look some more at modifiers later in the tutorial

Virtual inputs

Virtual inputs can be a percentage value, a time, a random number, a sine or square wave, a keyboard key or a variable.

They're handy if you want to send values to an output module like rainbow, without having to get those from a Flotilla input module.

We've looked already at a couple of the virtual inputs - sine waves and square waves - but now we're going to take a look at the random input and see how we can use it to generate some flicker-y values that we can use with rainbow later.

Clear away all of your existing rules, so that we can start afresh. You can do this by clicking the "on" next to each of the rules and then the red "x" at the right hand side of the rule, or the really quick way is to click on the anchor icon at the bottom of the screen and then clicking "clear".

First, click on the "+" icon below "input" to add a new input. Click "random" and then "fast".

Rockpool add random

You should see that there is now a new rule outputting random values.

Rockpool random output

Next, we're going to add a smooth modifier and see what effect that has on the random output. Click on the second "+" icon from the left in your random rule and then click on "smooth".

Can you see what has happened? The smooth modifier has made our jittery random values a bit smoother, like a random wave.

Rockpool smoothed random

Next, we'll add a difference modifier, so that we can mix in another random rule.

Click on the centre "+" icon to add a new modifier and then click "difference".

Rockpool difference modifier

When you first add it, you'll see that the output is the difference between the default 50% input rule that has been added and the random fast input rule.

We're going to click on that new 50% input and change it to a medium random input.

Finally, we're going to click on the modifier next to our new medium random input and add another smooth modifier.

Rockpool mixed randoms

What we now have is a random wave with just the right amount of jitter that we can use with the rainbow output module to make a flicker-y candle effect!

Flotilla output modules

There are 4 Flotilla output modules: number, rainbow, motor and matrix.

Here, we're going to use rainbow with our nice flicker-y wave we just created to make a candle effect.

Plug in your rainbow module with one of the blue Flotilla ropes into whichever port you'd like.

Click on the "+" icon on the right hand side of the rule we just made to add a new output. Select "rainbow" and then "brightness".

Rockpool add rainbow

You'll notice that... nothing is happening. That's because we're outputting brightness values to rainbow, but we haven't set a hue (colour) yet.

Add a new input, click "value" and then set the percentage to 5%, which should give us a nice yellow-orange hue.

Now, click on the right-most "+" on your new rule to add a new output, select "rainbow" and then "hue".

Rockpool rainbow hue

You should now have a flicker-y candle effect! Try sticking the dock and attached rainbow module inside an empty jam jar with some plain white paper around the inside to diffuse the light.

Linking Flotilla input and output modules

The final thing we'll do is to add in the touch module, and turn it into an on/off switch for our candle light. This brings together everything that we've learned about virtual inputs, module inputs, modifiers and module outputs.

Plug back in your touch module, with one of the blue Flotilla ropes, if it isn't still plugged in.

We're going to use the final empty modifier in our brightness rule. Click on the "+" icon and add then select the "min" modifier. This modifier outputs the lower of the two values fed into it.

You'll see that with the default 50% input, only brightness values of 50% or less are output.

Now, change the input to "touch" and then pad "one".

Rockpool min

You should see that rainbow is currently off. Touch and hold pad one on touch and you should see your rainbow candle light come back on. But to keep it on, we'd have to keep our finger held on that pad! Luckily, there's the toggle modifier for just that job.

We're going to add the toggle modifier to one of the two modifiers on our new touch branch that we just added. Click on one of them and then select "toggle".

Rockpool min toggle

Now touch and release pad one and your light should come on, release it and it should go off again.

So, we've seen that, with Rockpool, you can string together a series of fairly simple rules to make something really quite cool. Now, it's up to you to explore more and see what you can do with all of the other modules.