Sign in:

MOSS Flash

Firmware tools for MOSS

MOSS Flash is a tool that enables you to create new behaviors for your MOSS Brain and bring your robot construction alive using the MOSS Firmware API. Drag C programs onto the window, and they will be compiled in the cloud then flashed to MOSS.

moss_flash_screenshot moss_flash_code

Requirements

  • A MOSS Brain block
  • Your favorite code editor
  • An Internet connection
  • A bluetooth-enabled computer
  • Mac OS X 10.7+ or Windows 7+

Quick Start Guide

  1. Pair your MOSS Brain to your computer using Bluetooth. Make sure your Brain is powered up by a MOSS Battery block.

    Mac OS X 7, 8 OS X Mountain Lion: Set up a Bluetooth device
    Mac OS X Mavericks OS X Mavericks: Set up a Bluetooth device
    Windows 7 Windows 7: Connect to Bluetooth devices
    Windows 8 Windows 8: How to Add a Bluetooth Gadget

  2. Open MOSS Flash. Hang tight for up to a minute or two until it finds your MOSS Brain. If your MOSS Brain wasn’t found the first time try scanning again by clicking the Rescan button, making sure your Brain is close to your computer.

    moss_flash_step2
  3. Click the MOSS Brain you want to reprogram. moss_flash_step3

  4. Now you’re ready to program your MOSS Brain with MOSS Flash. Drag your C file onto the MOSS Flash window. If your C file is valid then it will be compiled and flashed to your MOSS Brain. Need some C files to start out with? See some examples below.

    moss_flash_step4a

    If your C file contains syntax errors, MOSS Flash will display the errors to you in the output console at the bottom of the window.

    moss_flash_step4b

MOSS Brain Firmware API

Click here to access the MOSS Brain Firmware API. The MOSS Brain Firmware API lists all the functions and data types needed to program the MOSS Brain. For additional information and support, visit the MOSS Forum.

Example Code

Here is the default template for a MOSS Flash program:

#include "moss.h"

void setup()
{
    // put your setup code here, to run once:
}

void loop()
{
    // put your main code here, to run repeatedly:
}
        

The setup function is where to place code that only runs once, when the MOSS Brain first boots. Use the setup function to initialize variables, timers, and other program state.

The loop function executes continually while the MOSS Brain is on, allowing your program to change and respond to its environment.

Here’s an example that simply blinks a face on and off every second:

#include "moss.h"

uint8_t blink_state;
uint8_t face_to_blink;

void setup()
{
    blink_state = 0; // the blink will start in the off state
    face_to_blink = FACE_3; // the face to blink
    set_face_state(face_to_blink, OUTPUT); // make the face an output
    set_face_value(face_to_blink, MIN_FACE_VALUE); // make the face start on a low value
}

void loop()
{
    wait(1000); // wait 1000 milliseconds before changing the blink
    if (blink_state == 0)
    {
        blink_state = 1; // turn the blink on
        set_face_value(face_to_blink, MAX_FACE_VALUE); // make the face value high
    }
    else
    {
        blink_state = 0; // turn the blink off
        set_face_value(face_to_blink, MIN_FACE_VALUE); // make the face value low
    }
}
        

For more examples, take a look in the Examples folder.

Troubleshooting Tips

Having trouble pairing your MOSS Brain to your computer, or connecting your MOSS Brain in MOSS Flash?
  • Verify that your MOSS Brain is powered on by a MOSS Battery block.
  • Make sure your MOSS Brain is not already connected to another Bluetooth device, such as an iPad or Android device. If so, unpair your Brain from the other device, then try pairing to your Mac or PC again.
  • Reset the power on your MOSS Brain, then try to pair again.
  • Remove the MOSS Brain from your computer’s Bluetooth devices, then add it again.
“Flashing failed.” and MOSS Brain won’t flash anymore?

Reset power on your MOSS Brain, then reconnect to MOSS Flash. Then try flashing your program again.

I tried flashing my MOSS Brain, and now nothing is working.

Sometimes an application can “brick” a MOSS Brain, in which case the MOSS Brain can’t communicate and it can’t jump to its bootloader, so it can’t accept new programs. However, you can use the magical face combination to force the MOSS Brain into bootloader so that it can accept a new program. Simply connect face 1 to 7 and face 3 to 5 with your flexy blocks. Then power on your MOSS Brain, and flash a new program.

My Mac says “MOSS Flash” cannot be opened because it is from an unidentified developer. Your security preferences allow installation of only apps from the Mac App Store and identified developers.

The first time you open MOSS Flash, you may receive a dialog with the text above, and MOSS Flash will not open. To open MOSS Flash, go to the “Applications” folder in Finder and find MOSS Flash, then right click on the icon, and select Open. The following dialog will appear:

Clicking Open will start MOSS Flash, and next time it will open automatically. For more details, see OS X: About Gatekeeper.

After reprogramming my MOSS Brain, my iOS or Android apps don’t work, or behave differently.

Although the iOS and Android apps are designed to work with reprogrammed MOSS Brains, certain programs can make apps behave in unexpected ways. For example, if you have a timer that fires very frequently, it could interrupt communication too often, making the MOSS Brain appear unresponsive. You can try making adjustments to your program to make it work better with apps, such as increasing the interval of your timers or decreasing the amount of processing done within your loop function.

You can also restore your MOSS Brain block to its default behavior at any time. You can do this in MOSS Flash by flashing the default program with an empty setup and loop function, or by opening MOSS Control and clicking the “Restore Default Firmware” button from the Firmware screen.