Difference between revisions of "BP Blockly User Guide"

From BP Wiki
Jump to: navigation, search
(Programming)
Line 30: Line 30:
 
* Actions: Right click offers a popup menu
 
* Actions: Right click offers a popup menu
  
= Programming =  
+
= Programming =
  
* To create an application drag blocks onto the canvas  
+
* To create an application drag blocks onto the canvas
* To create sensors and actuators, see [http://ww.b-prog.org/pres/agere2012 - Author Version.pdf  class="btn primary">AGERE!2012 paper &raquo;</a></p>pres/agere2012 - Author Version.pdf"  class="btn primary">AGERE!2012 paper &raquo;</a></p>
+
* To create sensors and actuators, see [http://ww.b-prog.org/pres/agere2012AuthorVersion.pdf  AGERE 2012 paper]
 
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events
 
* Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events
* B-thread priority:  
+
* B-thread priority:
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.  
+
** Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas.  
+
** Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas.
  
 
* To create
 
* To create

Revision as of 15:07, 16 April 2014

BP Blockly User Guide

Introduction

BP is implemented in Google Blockly by introducing new programming blocks, and by using the co-routines (generators) facility of JavaScript. Behavioral programs written in Blockly are translated into and executed as JavaScript programs.

Installation / Getting started

  • Install Firefox browser version 15.0.1 or later.
  • For online use: open with FireFox the designated Blockly link
  • For offline/local use on your computer:
    • Download the zip file containing the Blockly and JavaScript package from the download screen;
    • Extract the zip file, preserving directory structure;
    • Open with Firefox the file BP_Code\apps\BP\index.html;
  • Look at example projects in the examples drop down, additional examples linked from this site, and the tutorial

User Interface

Tabs

The BP Blockly interface introduces four tabs:

  • Blocks: In this tab, on the left is the 'pallet' or menu of Blockly blocks to choose from, and on the right is the canvas where the application is developed.
  • HTML: In this tab you program the HTML interfaces of your application, especially sensors and actuators.
  • Project Blocks: In this tab you can define new application-specific blocks. For example, application specific events.
  • JavaScript: This tab, shown in "debug" mode, shows the executable JavaScript generated from the Blockly code
  • XML: This tab, shown in "debug" mode, shows the text file where the entire application is stored.

Navigation

  • To scroll click and drag the canvas up or down, or use the scroll bar.
  • Note that at initial loading parts of an application may be hidden and you may need to scroll up.
  • Actions: Right click offers a popup menu

Programming

  • To create an application drag blocks onto the canvas
  • To create sensors and actuators, see AGERE 2012 paper
  • Your application is not required to have its own GUI and HTML – you can experiment with creating interwoven behavioral flow just with events
  • B-thread priority:
    • Round robin: All b-threads have same priority. Events that are requested and not blocked are chosen from the different b-threads in turn.
    • Strict priority: All b-threads are ordered, as determined by their top down and left-to-right placement on the canvas.
  • To create