What is BlocklyProp? How can I use it to program my S3 robot? If you are new to the S3 and to our BlocklyProp programming environment, you will get answers to these questions and more by following these short beginner tutorials.
You will need:
Prior knowledge of programming, robotics, or Blockly is a plus, but is not required here. We highly recommend you go through all of these introductory tutorials before moving on to other S3 Blockly lessons. You will need a window or tab open to the BlocklyProp website to follow along.
Need HELP??? If you get stuck, contact Parallax Tech Support: email support@parallax.com.
Follow the links below to get started!
BlocklyProp is a Parallax’s visual programming tool for the Scribbler 3 robot’s brain, the Propeller Multicore Microcontroller.
In the following tutorials, you will learn to use BlocklyProp’s building blocks to construct programs for the Scribbler 3 robot. The blocks are used to generate code that is then sent to a cloud server over the internet, compiled remotely, and returned as a file to download to your S3. Let’s take a look at how to set up BlocklyProp to program your S3 robot.
BlocklyProp is based on Blockly, an open source project from Google, loosely based on the MIT Scratch block programming system. More information about develpment of Google’s Blockly can be found on the project page at the https://developers.google.com/blockly/.
If you have already connected your battery, just skip these two checkmark instructions.
For more information or instructions on battery safety and your S3, see the Startup Guide Poster that came with your Scribbler 3 robot. You can also view and print the poster here, https://www.parallax.com/downloads/scribbler-s3-robot-info-poster.
BlocklyProp Solo replaces our original BlocklyProp tool. BlocklyProp Solo does not require registration, and your programs are stored on your computer. You will need to install the BlocklyProp Launcher on your computer; it replaces the original BlocklyProp Client.
Dwnload and install the BlocklyProp Launcher for Windows or Mac, or get the extesion for Chromebook, from the Parallax store site, and then run it. Or if it is already on your computer, run it now.
BlocklyProp Launcher Downloads
The Edit pane for your project will open.
If you have opened BlocklyProp Solo not installed the Launcher ahead of time, you will see a pink alert bar with the message “BlocklyProp Launcher not found. Click here for instructions.”
A download instruction window for BlocklyProp Launcher will open. Under Download the Installer, you should see options for your operating system.
Special thanks to Parallax friend Whit Stodghill for his assistance in writing, editing, and testing material for these S3 tutorials.
Now you have BlocklyProp Solo open in Chrome, and the Launcher installed. It is time to run your first project!
BlocklyProp programs are also called “projects.” In the Edit pane, you build a project by making selections from the gray block menu to the left of the Edit pane. Some menu items expand to give you more choices.
You will see a message that says Compile….Download….then a terminal should open and display your text exactly as you typed it into the block:
It is good practice to save your BlocklyProp projects to your computer frequently while you work. In fact, a message will pop up every 20 minutes to remind you.
Once you load a project to your S3 robot’s memory, you cannot get the project out and back into BlocklyProp. But, if you save a copy on your computer, you can always open it again to run it or to make changes.
Special thanks to Parallax friend Whit Stodghill for his assistance in writing, editing, and testing material for these S3 tutorials.
Now that you know how to write and save, and load a simple “Hello” program for your S3 robot using BlocklyProp, what’s next? Now, you will take it one step further and learn how to change an existing program by adding LED blocks.
Note: Most programs already loaded to EEPROM can be run again by simply pressing the blue reset button on the S3. Some very short programs like the one above do not activate the part of the S3’s system that monitors the reset button, so pressing it will not reset the S3.
:
Now, let’s say you want to do a bit more by adding other blocks to a program.
This menu lets you do many useful things (try them out, if you’re curious – but be careful not to delete blocks you want to keep!):
You’ve just edited your first BlocklyProp LED program! Now let’s see if it works.
You should see the USB TX/RX flashing amber, the blue charging and power LEDs glowing. How about the center bicolor indicator LED? Did it light up green first and then turn red as planned? Did you see your message on the Terminal? Did you see it all? It happens quickly.
Let’s try again. This time using a different method.
Special thanks to Parallax friend Whit Stodghill for his assistance in writing, editing, and testing material for these S3 tutorials.
You may have already used the reset button to scroll through the pre-programmed demos your S3 came with, but did you know that you can use the reset button in your personal BlocklyProp programs?
As you learned in the previous lesson, the blue reset button is actively monitored by your S3. When you press it, the S3 not only knows that it has been pressed, but it also counts and tracks the number of times you press the button in succession. Using this information, it will then display that count with the indicator LEDs and can even carry out certain commands in your code.
The reset button is used to select between the 8 pre-programmed Demonstration programs for the S3. It may be one of the first features you use. The Scribbler 3 Start-Up Guide shows you that the number of times the reset button is pressed is counted and lets you select which of the 8 default Demo programs runs on your robot.
The code temporarily saves a count of the number of times the button is pressed as the S3 is reset. It gives visual feedback for the number of presses with the S3’s indicator LEDs (see the LED tutorial in “Lights and Sounds” for more information) in the following manner:
This feature can be defined in BlocklyProp so that the programmer may run programs or make program selections.
Take a look at this simple BlocklyProp code below:
The four blocks used are:
The code breaks down as follows: “if” the reset button is pressed once (during the last reset), the program will “do” whatever code is inserted in the keyed bracket. This code is not complete because there is nothing for it to “do” as it is shown. By inserting a program or command into the bracketed space, you create a way to execute it with the press of the reset button.
You can modify or enhance the code by changing the value of the number value block, so that some other number of button presses is required. You can copy the whole code multiple times and use it to execute different functions based on the number of button presses (from 1 up to 8 choices). This is how the default 8-demonstration program that came pre-programmed on your S3 works.
Remember that the S3 will track the number of presses, giving you feedback with the LEDs as described above, because those instructions are part of your robot’s core program.
This code can be added to the code of any of the examples that follow in the Learn S3 tutorials. As you experiment with new programs, challenge yourself to utilize the tools you’ve learned such as this one. You may be surprised at what you are capable of creating without the aid of step-by-step instructions like these. Or, you can run the code shown in each example exactly as it’s shown, tucking this information away for later use. As the programmer of your S3 robot, you are in charge!
Button-press monitoring code is hidden in a lot of electronic gadgets that you use regularly. This sort of code allows users to make intuitive choices about what a device will do. Though we use such a feature regularly in our everyday lives (anything electronic with buttons probably uses it), we are often unaware or blind to its presence because it is so common.
Keep in mind that when you run the program the Terminal will open, but the Hello World! message will not be sent until you press the reset button.
Special thanks to Parallax friend Whit Stodghill for his assistance in writing, editing, and testing material for these S3 tutorials.
Welcome to the BlocklyProp Tips & Tricks for the Scribbler 3 Robot. Study these short resources to learn a little something more about BlocklyProp blocks or how to use some of the basic BlocklyProp features.
Refer back to these pages as often as you like. They will likely come in handy as your BlocklyProp programs progress in length and complexity.
Every once in a while a note of explanation to another code user or to yourself is helpful. Comments or notes are used by coders to leave instructions, reminders, and information inside their code – for themselves or for those who might also use their work. This is done in BlocklyProp with the note block.
Comments are notes about your code that help explain to other people what your code is doing. Also, it is good to leave comments as notes to yourself about what you were doing in case you need a reminder days (or months or years) later. The process of leaving notes or comments in your code is referred to as “documenting your code”.
You can help make your code self-documenting by picking variable and constant names that help make the program more self-explanatory. In a visual program language like Blockly, code often explains itself.
Why might you leave a note in your code?
Know that coders have differing ideas about comments – some prefer very few comments or even none at all, others prefer thorough documentation.
Remember that with BlocklyProp the code visually explains, so less is more!
This is the add comment block. It is found in the CONTROL category:
In addition, blank separator can be chosen from the dropdown menu on the block:
The blank separator option turns the block into a blank white block. Just like adding a comment, using a blank separator has no effect on your program. You can use it to create visual separation between parts of your program. The block can be changed back to an add comment block by clicking on the triangle and selecting comment.
In the example below, the coder named his program, recorded the date it was written, and listed himself as the author.
The purpose of such a comment might be so that this info could be recorded in a screen captured image of the code. Use comments in your BlocklyProp programs when they serve a specific purpose for you or for someone else. Otherwise, they can clutter your code and be more confusing than helpful.
Note: The add comment/blank separator block has no effect in your code. You can place them anywhere within your program that you need to make a note and it will not change your program’s behavior in any way.
Special thanks to Parallax friend Whit Stodghill for his assistance in writing, editing, and testing material for these S3 tutorials.
One of the best ways to learn about all the features of BlocklyProp is allowing yourself time to explore and be curious.
For example, look at a block from the MATH category: the math operation block. You can see that it allows the user to input a value, variable, or test into the block to create a complete block command that has an output. In this block the input is “inline”, meaning the block reads in-a-line from left to right.
Presto! The block changed shape, transforming from inline input to external input.
Take a look at how the example block changed. You can see that they do the same thing, but format is different. The shape of the block is merely a preference. You can re-shape these blocks to suit your personal preference, or to create narrower programs if you need to take screencaptures or work from a minimized window.
Like it better the other way? No problem. Right click again and the menu reappears with the choices. This time you will see “Inline Inputs” instead and, when you select that option, you can go right back to the original block format you started with.
BlocklyProp blocks are created using the open source tools from Google’s Blockly resources. They can be created using Blockly with a tool called the Block Factory. You can give it a try anytime – there are even videos to show you how! Visit the Block Factory here.
As mentioned in the last section, you might need to make your program smaller in size. This can be for any number of reasons, but the important thing to note is that there is another way to shrink the physical dimensions of your program blocks: Collapse Block. This feature is explained later in these tutorials when you start to see large, complex programs, but it’s worth mentioning here as well.
Blocks, such as the math operation block you’ve been working with, can have inline input fields that require you to nest other blocks inside. If those other blocks are wide, then you can start to see programs extend greatly in a horizontal direction. This can make it difficult to see or read your entire program without scrolling or resizing windows. Collapsing a block with other blocks inside of it will automatically collapse those other blocks too.
Look how small it became. To change it back, right-click on the block again and choose “Expand Block”.
This feature will be discussed again later on, but keep in mind that it is there to simplify the appearance of your program. No information is lost when a block is collapsed (your program will still run the same), but some information is hidden to reduce its physical size.
Make a mess? Just drag it to the trash can or choose “Delete Block” from the right-click menu. Have fun!
Special thanks to Parallax friend Whit Stodghill for his assistance in writing, editing, and testing material for these S3 tutorials.
Perhaps no block in BlocklyProp has more programming power per pixel than the factory restore block. You can find it in the ACTIONS > RESTORE category.
It looks like this:
Notice that this block has no connecting tabs. That is because it is meant to be used alone. Its purpose is simple: to restore the factory demo program that came pre-loaded on your new S3 robot. These demo programs are designed to show off the capabilities of the S3, right out of the box.
One side has product, safety, and other information. The other side shows all the demonstration programs from the factory. Each different demo is accessed by pressing the reset button the specified number of times, and they are meant to showcase one or more of the S3’s sensors or abilities.
This factory program is probably the largest and most complex program your S3 will ever load to EEPROM and run. It takes advantage of every sensor and, except the Hacker Port, most every bit of hardware that is built into the powerful S3 robot. This one block restores all of that original code in one simple step.
Every time you write and send a program to the S3, this demo is replaced by your new code. To make your S3’s software factory fresh, simply follow the instructions in the next section. You can do this anytime you want.
To restore correctly, be sure the factory restore block is the only block in your workspace.
That’s all there is to it. You have now restored the S3’s factory demo code. See the S3 Info Poster for complete features.
Special thanks to Parallax friend Whit Stodghill for his assistance in writing, editing, and testing material for these S3 tutorials.