Using Scratch with your ALLBOT blog banner

Using Scratch with your ALLBOT

If you’re new to the world of making and programming, using Scratch to program your ALLBOT is a great way to get started. Our ALLBOT Expandable Robot System is a DIY kit that gives you the power to build and program your own robot. ALLBOTs are programmed using the programming language C through the Arduino IDE.

Since C may be difficult for beginners, we’ve integrated MIT’s user-friendly programming software, Scratch, as a tool for programming ALLBOTs. Scratch allows you to drag and drop your code and visually see your project come to life.

We’ve already assembled our ALLBOT VR408 and even printed off a handy stand for our four-legged friend. If you’re currently ALLBOT-less, you can purchase your two or four-legged ALLBOT and follow the assembly manuals here.

Setting up Scratch

Before we get to programming, there are some downloads and installations that need to be taken care of first:

  1. Adobe Air (Note: Must be installed before Scratch)
  2. Scratch 2 Offline Editor
  3. ALLBOT Communicator - Scratch programming for ALLBOT
  4. Make sure you have the latest Arduino Software version

Note: This installation focuses on Windows computers and uses the VR408 ALLBOT for the demonstration. For a more in-depth installation guide or instructions for Mac users, visit our Scratch for ALLBOT Installation and First Usage Guide.

After installation is completed, we need to make sure the ALLBOT libraries are copied to your Arduino libraries. This allows you to use our preset ALLBOT movements within Scratch.

1. Find your ALLBOT library (usually C:\Users\You\Documents\Scratch programming for ALLBOT\Arduino\Library) and copy them to your Arduino library (usually C:\Users\You\Documents\Arduino\libraries\ALLBOT).Step 1 - Copy the ALLBOT library to your Arduino library

2. Connect your ALLBOT to your computer and make sure it is in Program mode.

3. Open the Arduino IDE. Select File > Open and navigate and select the Scratch Sketch that corresponds to your ALLBOT (usually C:\Users\You\Documents\Scratch programming for ALLBOT\Arduino\Sketch):

  • VR204 Scratch - for the 2 legged ALLBOT with 4 servos
  • VR408 Scratch - for the 4 legged ALLBOT with 8 servos
  • VR412 Scratch - for the 4 legged ALLBOT with 12 servos
  • VR612 Scratch - for the 6 legged ALLBOT with 12 servos
  • VR618 Scratch - for the 6 legged ALLBOT with 16 servos

Step 3 - Open the Scratch library that matches your ALLBOT

4. Disconnect your ALLBOT from your computer and recycle the power, then reconnect. Your ALLBOT should chirp 3 times.

5. Open ALLBOT Communicator. You should see a COM port connection in the bottom left corner of program. Click connect. Your ALLBOT should chirp again.Step 5 - Open ALLBOT Communicator - Scratch programming for ALLBOT and connect your ALLBOT

6. Open Scratch 2 Offline Editor. Hold Shift and click on File. Then select Import experimental HTTP extension at the bottom of the drop down menu.Step 6 - Import experimental HTTP extension into Scratch 2 offline editor

7. Navigate to the Scratch programming for ALLBOT folder and open the Extension folder. Select the extension folder that corresponds with your ALLBOT and open the .s2e file inside.Step 7 - Open the matching .s2e file for your ALLBOT in Scratch

8. In Scratch 2, select More Blocks under the Scripts tab. These commands control your ALLBOT.Step 8 - Have fun programming! Your ALLBOT scripts are located in the More Blocks tab

Programming

You’re all setup now! Now we are ready to start programming your ALLBOT. Double clicking the commands will trigger the action on your ALLBOT. You can also drag multiple blocks and connect them in the Script area to trigger a chain of commands.

Commands definitions

  • Set movementspeed - sets movement speed for all commands. Standard is 128 but the ALLBOT's range is from 0 - 255.
  • Set X steps - sets the number of steps to take in a forward, backward, left or right direction.
  • Lean - lifts up the first servo on both legs facing forward, backward, left or right.
  • Look - traverses to look either left or right and turns to start position.
  • Turn X degrees - sets the left or right turning degree.
  • Wave X times - sets the number of waves to complete on either the frontleft, frontright, backleft or backright leg.
  • Scared - sets the number of shakes and chirps your ALLBOT completes as it retracts its legs.
  • Chirp - sets number of chirps to complete.

The last four commands are for controlling ALLBOT accessories such as theVelleman VR002: ALLBOT Sensor Pack.

  • Digital pin
  • Read analog pin
  • Write X to digital pin
  • Write X to analog pin

Now it's your turn. Build your favorite chain of commands and tweet us @VellemanStore or let us know how you use Scratch with your ALLBOT.

Popular ALLBOT Products