12Blocks
Welcome | Contents | Getting Started | Reference | Hardware | FAQ | Buy
Blog | Forum
Overview | Editor Interface | Editor Dialogs | Advanced | Language | Blocks

Menus

Menus

File
·     New: start editing a new worksheet
·     Open: opens a file
·     Save/Save As: save a file in one of these formats
·      .12b: the default for 12Blocks
·     .spin: compatible with the Propeller Tool
·     .png: a graphical image of the code
·     .xml: a computer readable format of the program for easy integration
·     .zip: an archive of all files related to this program
·     .exe: a single file that will run your program without requiring 12Blocks
·     Close: closes the worksheet
·     Examples : displays categories of example files, click to load one
·     Tutorials: displays guided tutorials, click to load one
·     Online Community: visits http://onerobot.org/products/12blocks/share/ to view and manage shared files.
·     Upload to Web: Uploads file to share with online community
·     Import Blocks: imports blocks into the current worksheet from an existing file
·     Print: print the worksheet
·     Recent Files: load a recently used file
·     Exit: quit out of 12Blocks
Edit
·     Undo/Redo: use to recover from mistakes
·     Cut, Copy, Paste,Delete, Select All: editing tools, refer to advanced editing to use them
·     Find: shows a map of all blocks that you can search with keywords.  Click on a location to zoom the worksheet to that location.
·     Preferences: Configure 12Block preferences here
View
·     Code: textural representation of the worksheet's program appropriate for the currently selected device
Device
·     Run: runs your program on your device
·     Burn: loads your program into your device's permanent storage so it can be run after turning the device off
·     Control Device: displays a dialog to interactively control your device
·     Reset Hardware: sends a reset signal to your device
·     Connect/Disconnect: pauses/resumes the connection with your device.  When paused, the variable values, IO status, terminal won't be updated.
·     Stop Device: loads an empty program to stop all actions to your device
·     Configure Com Port:configures the port to be used to communicate with your device
·     Device Manager: displays a dialog to manage your devices
Debug
·     Start Debugging: starts a debugging session
·     Pause/Resume: pauses/resumes the program being debugged
·     Clear Breakpoints: sets a breakpoint where your program will pause
·     Single Step: instructs your program to take a single step
·     Insert Terminal: inserts a terminal block to send/receive text
·     Insert View Values: inserts a value block to view and edit variable values
·     Insert Graph: inserts a graph block to graph variable values in real time
Help
·     Reference: view this help reference.
·     Getting Started: view a guide that works through several dozen examples
·     Register: register your copy of 12Blocks
·     Updates: update to the latest version
·     Report a Bug: report a bug or desired feature
·     12Blocks.com: learn more about 12Blocks
·     About: view the version of this software

Toolbar

The 12Blocks toolbar makes it easy to access the most common features:

graphic

·     Run:  runs your program on your device
·     Pause: pauses your device, click again to resume.  Blocks which show device data will retain their current value.  On some devices your program may continue to run- use the Stop button to stop all actions.
·     Stop:  loads an empty program that stops all actions to your device
·     Burn: loads your program into your device's permanent storage so it can be run after turning the device off
·     Control: displays a dialog to interactively control your device
·     Port:indicates currently active port and can be clicked to configure the port to be used to communicate with your device
·     Mode: indicates current mode and can be clicked to configure which mode to use
·     Library: indicates current library and level.  Can be clicked to manage your device and select what level blocks to show (beginner-advanced-expert).

·     Worksheet Tab: Switch between the worksheets by clicking on the named tab.  Click the "x" to close a tab.  Right click on a tab to:
·     New: create a new tab
·     Close me: close this tab
·     Close all but me: close all other tabs
·     Save me, Save me As: save this tab
·     Save All: save all tabs
·     Revert: reload this file- erasing any changes made since last loading it
·     Copy Code Image: copies an image of the worksheet to your clipboard
·     Open as Text: opens the worksheet in a text editor
·     Expand All: expands all previously collapsed blocks
·     Collapse All:  collapses all blocks


  

Worksheet

Choose a library section and then drag blocks from the library to the worksheet:
graphic

Join blocks by bringing blocks close to each other until the block tabs join up:
graphic

Click on yellow parameters to change their value:
graphic



Right click on the worksheet to:

Cut, Copy, Paste, Delete, Select All: editing tools, refer to advanced editing to use them
Expand: expands a previously collapsed block
Collapse: collapses a block, see below for the collapsed set of blocks on the left:
graphic
Change block: some blocks can be converted to another block with similar functionality but different parameters
Convert block to comment: converts block to a comment which does nothing when run
Restore block from comment: converts a comment back to a block, see below for a commented block:
graphic
Toggle Breakpoint:  sets/clears a breakpoint where your program will pause, see below for a block with breakpoint:
graphic
Get Help: shows help for the selected block
View Code: views equivalent text code for the block for the current device
Properties: view/change properties for the block

  

Debugger

Background
When you press the "Run" button, 12Blocks first generates a text representation of your block program.  12Blocks then loads the compiled program to the device where the device's microcontroller executes the program.  Once the program has been started, it runs at full speed and 12Blocks is not able to pause it.

Block Emulation
To help you debug your program with step-by-step debugging and breakpoints, 12Blocks comes with a debugger.  The debugger emulates the behavior of each block to allow you to pause the program at any point.  For example, the "set x=1" block is emulated by setting an emulated variable to the value of 1.  Blocks that cause visible changes like "motion" are a bit tricky.  In this case, 12Blocks commands the real device to move a set amount.  The debugger is designed emulate your device's behavior as closely as possible while still allowing you to have more control over your program's behavior. 

A typical debugging session
See below for a simple program that should move the robot 3 times.  Notice that the "repeat" block has a red square on the top-right, this is a breakpoint.  When this program was debugged with the "Debug>Start Debugging" menu command, the program ran until it hit the breakpoint. graphic

At this point we can step through one block at a time by pressing "Debug>Single Step". Here's the result after one step, notice that the "change" block is now hi-lighted:
graphic

Here's the next step, notice the new value of x:
graphic
Taking one more step will cause the robot to move 100mm forwards.