1Getting Started with Maven (MacOSx)
Some versions of MacOSx come with Maven installed. To check, in the terminal, enter:
If Maven isn't installed, download it here. Unzip the file and place the folder in the desired location.
Next, you will need to update (or create) a file using vim (programming language).
In the terminal, enter:
This window should pop up. The first line contains the path for wherever you placed the maven folder. The second line should be the same as in the screenshot.
Some necessary vim commands:
i - insert mode, press esc when finished editing
:wq - save changes and quit vim (press enter afterwards)
:q! - force quit vim without saving changes (press enter afterwards)
Restart terminal and to verify installation, once again enter:
Tutorial here for reference.
2Install ArduBlock and OpenBlocks
Download ArduBlock here.
In the ardublock-all folder, run the install_openblocks executable which installs OpenBlocks.
Once completed, in the terminal, enter:
This command installs arduino's pde.jar file into the local repository. You should be all set to complile.
In terminal, set the directory with the cd command.
To compile ardublock use the following command:
mvn compile exec:java -Dexec.mainClass="com.ardublock.Main"
To create a .jar file for the program Arduino itself to run, enter the following:
mvn clean package
The .jar file is created in:
Copy this file to:
Arduino will now run your version of the program.
4Code Structure Diagram
These three files contain the most important parts of code in order to alter ArduBlock:
- Found under ardublock-all/src/main/resources/com/ardublock/block/ardublock.xml
- BlockGenuses - instructions and details for each block found in ArduBlock
- BlockDrawers - the set of blocks to be found under the same tab in ArduBlock
- BlockFamilies - define the dropdown options to replace any math operator or variable/constant in ArduBlock
- BlockGenus Properties:
- name - block name that will be referenced by block-mapping.properties
- kind - can be type command (begins the code functions), data (fills command blocks), or function (math operations)
- color - hex code color
- initlabel - will be bg.name, used as reference for ardublock.properties
- list of BlockConnectors that describe what will appear on the right side of the blocks
- BlockConnector Properties:
- connector-type - number/boolean/string/poly/number-list, describes the kind of data the block wants to input for this specific connector
- connector-kind - socket/plug, most connectors will be "socket", but the last BlockConnector for each BlockGenus will describe the block as a whole and is usually plug
- label - the name of the connector that will appear next to the block socket
- Found under ardublock-all/src/main/resources/com/ardublock/block/block-mapping.properties
- Lists the name of each block as described in the BlockGenus properties of ardublock.xml, then sets them each equal to their respective Java files that determine their functionality.
- Blocks that do not have links to Java files can be found in TranslatorBlockFactory.java under /src/main/java/com/ardublock/translator/block/ along with the rest of the Java files.
- Found under ardublock-all/src/main/resources/com/ardublock/block/ardublock.properties
- References the "initlabel" for each BlockGenus described in ardublock.xml using bg.blockGenusName, in order to define each of their names as they will be shown in ArduBlock.
- Also references BlockConnector and BlockDrawer labels/names from ardublock.xml to define the names as they will be shown in ArduBlock.