-
1Getting Started with Maven (MacOSx)
Some versions of MacOSx come with Maven installed. To check, in the terminal, enter:
mvn -version
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:
vim ~/.bash_profile
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:
mvn -version
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:
mvn validate
This command installs arduino's pde.jar file into the local repository. You should be all set to complile.
-
3Compile Commands
In terminal, set the directory with the cd command.
cd /Users/Nate/arduproject/BarnabasRoboticsArdublock-master/ardublock-all
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:
/ardublock-all/target
Copy this file to:
/Users/[your username]/Documents/Arduino/tools/ArduBlockTool/tool
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:
- ardublock.xml
- Found under ardublock-all/src/main/resources/com/ardublock/block/ardublock.xml
- Contains:
- 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
- block-mapping.properties
- 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.
- ardublock.properties
- 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.
- ardublock.xml
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.