Sign in:

Cubelets Flash

Reprogram your Cubelets! Cubelets Flash is a simple app for Mac and Windows that lets you drag C programs onto any Cubelet in a robot and reprogram in real time. Connect your Bluetooth® Cubelet or Bluetooth Hat to your computer and unlock the power of Cubelets Flash to create new advanced behaviors for your robot constructions!

Why is it called Flash? Each Cubelet contains a tiny computer called a microcontroller. Typically, when engineers change the programming in a microcontroller, they call it “flashing”.

Important: Cubelets Flash only works with Cubelets that are running OS4 and won’t recognize Bluetooth Cubelets running an older operating system. If you have older Cubelets, please upgrade them to OS4 using the Cubelets Mobile App for iOS or Android.

Cubelets Flash Screenshot Cubelets Flash Screenshot

 

Getting Started:
1.  Download and Install Cubelets Flash

Get the latest releases from Github.

2.  Connect to your Bluetooth Cubelet or Bluetooth Hat

Power up your Bluetooth Cubelet or Hat with a Battery Cubelet and make sure the Battery’s power switch is on. Next, pair your computer with the Bluetooth Cubelet or Hat. On a Mac, click the Bluetoth icon in the menu bar, and on Windows, use the Bluetooth settings page. Now that you’re paired, open up Cubelets Flash and select your Bluetooth Cubelets. Bam.

3.  Hello, world!

OK, let’s try something pretty simple so you can get the hang of programming Cubelets. Find a Flashlight Cubelet and attach it to the Bluetooth Cubelet. Also add in a Sense Cubelet somewhere, like a Knob or a Distance sensor. You should see each of these Cubelets pop up in the graph display on the left side of Cubelets Flash. Click on a Cubelet in the graph and you’ll see some detailed information about it on the right pane. Try manipulating the sensor; the Flashlight should react as normal, growing brighter or dimmer according to what the sensor senses.

Let’s reprogram the Flashlight Cubelet. Here’s a simple sample program that will cause the Flashlight to blink at a different rate (instead of light up at a different brightness) according to its blockValue. Download the program to your desktop (or rewrite it in a text editor if you want). Your computer might hassle you a little bit about downloading a C file, but it’s OK. Click on the Flashlight Cubelet, then drag this program into the target area. It will take a few seconds to compile, and another few seconds to Flash. You can follow flashing progress by watching the LEDs on your Cubelets. While the program is uploading the Bluetooth LED will blink. Then, the target Cubelet LED will blink while it is being reprogrammed. Now try using the sensor! Cool.

Programmers and engineers call a simple program that helps them figure out a system, Hello, World!. Getting a first program flashed onto Cubelets is the tiny robots equivalent of Hello, World!

4.  Restore

It can get a little confusing if you have some stock Cubelets and some reprogrammed Cubelets around. With the Flashlight Cubelet still selected, click the RESTORE DEFAULT FIRMWARE button and wait for the Flash to complete. Good as new.

5.  Now, write your own program

We’ve published a ton of simple sample Cubelets programs. These will help you understand how Cubelets work and get used to reprogramming. Take Cubelets to the next level by writing your own programs using the Cubelets API!

 

Key Concepts
Block Value

Every Cubelet has a block value: a number that ranges from 0 to 255. The block value of a Sense Cubelet is based on its sensor. For example, in a really bright room, a Brightness Cubelet will have a block value of 255. If it’s really dark, its block value will be close to zero. Action blocks use their block values to operate their actuators. With a block value of 255, a Drive Cubelet drives at maximum speed. For a Flashlight Cubelet, a block value of 255 lights the flashlight at its brightest.

Sense, Think, Act

Think of a robot as a device that thinks, senses, and acts (that’s why we have Sense Cubelets, Think Cubelets, and Action Cubelets). Each individual Cubelet performs at least one of these functions. When we reprogram Cubelets, you will see that the programs you write always follow this pattern.

The setup() and loop() functions

Your code to reprogram a Cubelet will contain (at least) a setup () function to start the block when it’s first turned on, and a loop() function to tell it what to do when it’s running. (It may contain other routines also, but that’s another story). Setup happens just once when you first power on your robot. The loop function is called over and over again while your robot is powered on.

Cubelets API

To make programming your Cubelets easier, we have created an application programmer interface (API) for some of the most common tasks you will want to accomplish. For a sneak peek at what the API offers, please see the API reference.

Network Graph

The network graph is an abstract view of your robot construction. It’s shown as a graph instead of as a rendered robot because a Cubelets connector has four orientations and Cubelets don’t know which orientation their neighbors are connected through! In order to specify which Cubelet you want to reprogram or to control remotely, you first select a node on the graph. When you select a Cubelet, the green LED on the Cubelet will stop blinking and stay on. That way you know which Cubelet you have selected when you have more than one of the same Cubelet types in your robot. Each Cubelet has a unique ID number, which is shown detail pane. It’s very useful to know this ID when reprogramming a Cubelet to interact with other specific Cubelets.

 

Resources