How to Hack ArduBlock

Here is a short tutorial on how to start hacking ArduBlock

  1. Fork and check out ArduBlock and our version of OpenBlocks
  2. Open both in the Eclipse
  3. The language description is located at ardublock/src/main/resources/com/ardublock/block/ardublock.xml
  4. To add a block, create a BlockGenus. We will use the “Digital Push Button” as an example here:


    <BlockGenus name=”df_digital_push_button” kind=”data” color=”255 102 0″ initlabel=”bg.df_digital_push_button“>

        <BlockConnector connector-type=”boolean” connector-kind=”plug”/>
        <BlockConnector connector-type=”number” connector-kind=”socket” label=”bc.pin_number“>
          <DefaultArg genus-name=”number” label=”1″/>

    • Each block has a plug side expressing its data output. For the sensor block, it is either “boolean” or “number.”
    • The socket sides of the block express the data needed for its function. In this case, the “pin” the button is attached.
    • The image is located under src/main/resources and the relative path name to this directory should be used.
    • all text in the attributes “initlabel” or “label” will get run through a localization process and the localized text are stored in “src/main/resources/com/ardublock/block/” for English. Translation into other language is managed at the ArduBlock Translation.
  5. Add the block to a Drawer.

    <BlockDrawer button-color=”255 102 0″ name=”bd.dfrobot” type=”factory”>

  6. The code generation backend is located at src/main/java/com/ardublock/translator/block/