How To Edit Ardublock Project – Block-Based Programming

ardublockarduino

This tutorial is the second in a series of three, which are intended to introduce you to the Ardublock block-based programming environment.

In the previous tutorial, an overview was made of several alternatives for block programming. In this tutorial, we will show the processes necessary to make changes to Ardublock. The method of adding the changed tool to the Arduino IDE will also be covered.

Parts Required

If you don’t have git installed, you can download it directly using “Download ZIP“. More info in Download Ardublock and OpenBlocks source code section.

Install and check if Java JDK is installed

1. Download and install Java JDK compatible with your operating system (link).

2. Access Run Console (Win + r) and type “sysdm.cpl“.

3. Go to “Advanced” and click on “Environment Variables…”.

4. On “System variables” check if exist “JAVA_HOME” variable. If not, click on “New…” and create it (where the value is the path for “jre” files).

Download and Install Maven

1. Download Maven binary files.

2. Unzip the package file for this path: “C:\Program Files\”

3. Create a new environment variable with the name “M2_HOME” and the value of your version of maven installed in your OS (in this tutorial is used Maven 3.8.4) “C:\Program Files\apache-maven-3.8.4”.

4. Create a new variable environment “MAVEN_HOME” with the value of the path where the maven binary where unpackaged ” C:\Program Files\apache-maven-3.8.4 ” (like the last step).

5. Now it is necessary to add the following path “%M2_HOME%\bin” to the system variable “path”.

6. To check if Maven is installed you need to open Command Prompt or Powershell (Win + x) and execute this command “mv -version”.

Example of a successful result.

Download and Install Eclipse

  1. Download the version of Eclipse IDE for your OS.

2. Extract the package of Eclipse to the destination that fits you well.

Example of destination.

Download Ardublock and OpenBlocks source code

1. Create a directory to put all your Eclipse projects and inside create a folder “Ardublock-Workspace”.

2. Access this link and copy the URL to clone the project with git. If don

3. Open git on “Ardublock-Workspace” and clone the project. If you don’t have git installed, you can download it directly using “Download ZIP”, then you can skip to step 5, where you will also have to unzip the folder after downloading.

4. Go to another folder, like “Projects-Eclipse” for example, and repeat the same process to this repository.

The final appearance of “Projects-Eclipse”.

5. Open the “Ardublock” folder inside of “Projects-Eclipse” and access “Source\openblocks-master“. Copy “openblocks-master“.

6. Go to “Ardublock-Workspace” and paste it there.

Preparation of projects for editing

1. On “Ardublock-Workspace” open “ardublock” folder. Pressing the Shift key and right mouse key select “Open PowerShell window here“.

2. In this window run the following command: mvn validate. This command is to download the folders related to Maven important for the construction of this “project” (Ardublock).

3. In this window run the following command: mvn clean. Clean up unnecessary files.

4. In this window run the following command: mvn eclipse:clean.

5. In this window run the following command: mvn eclipse:eclipse.

6. In the “Ardublock-Workspace” folder, enter the “openblocks-master” folder and press Shift, and the right mouse key select “Open PowerShell window here” (Figure 5.6) so that a command line appears. Then run the following command: mvn clean.

7. In this window run the following command: mvn install. Thus installing Openblocks in the Ardublock project, in order to avoid possible construction errors.

Import project into Eclipse

1. After starting the Eclipse IDE, you should select the workspace as the directory of the previously created folder, as shown below.

2. To import the Ardublock project, go to File>Import.

3. In the “General” folder select “Existing Project into Workspace” and click “Next”.

4. Check if the Ardublock folder directory, with the source code, located in the “Ardublock-Workspace” folder appears in the topic “Select root directory:”. If the desired directory does not appear, click on “Browse…” and proceed with the selection of the desired directory. Completing this action by clicking “Finish”.

5. To solve some of the problems, with the mouse pointer over the project folder click with the right button of the mouse and select “Properties”.

6. Before clicking “Add Variable…“, select “Java Builth Path” and “Libraries“.

7. Select “M2_REPO” and click on “Extend…“.

8. Select the path “edu/mit/openblocks/1.0-SNAPSHOT/openblocks-1.0-SNAPSHOT.jar”.

9. To solve the rest of the open the folder “src/main/java“, right click on “com.ardublock.translator.block.DuinoEDU” package and rename it to “com.ardublock.translator.block.Duinoedu”.

10. To proceed with the project execution it is necessary to select “Run As” and “Java Application” (as shown below). Then select the “Main” file.

Add Ardublock to Arduino IDE

1. Check if “C:\Users\user\Documents\Arduino\tools\ArduBlockTool\tool” exists in your system, if not you need to create it.

2. On Eclipse IDE, go to File>Export.

3. Select “Runnable JAR file“.

4. On “Launch configuration:” select “Main – ardublock“. In “Export destination:” put the path created before “C:\Users\user\Documents\Arduino\tools\ArduBlockTool\tool\” and the name of “.jar” file (for example, “ardublock.jar”). In “Library handling:” select “Extract required libraries into generated JAR“.

5. Now start Arduino IDE and check if Ardublock is installed.

Conclusion

In this tutorial, it was shown how to add the Ardublock plugin to Arduino IDE. Furthermore, it was shown how to modify the plugin, allowing the creation of blocks as needed. For example, make it possible to create blocks for a particular development kit. This functionality (changing or adding blocks) will be deepened in the next tutorial.

References

[1] http://blog.ardublock.com/2011/10/25/install-ardublock-arduino-ide/

[2] http://blog.ardublock.com/2012/06/11/setup-ardublock-development-in-eclipse

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock