How to Create a new Ardublock


HOW TO CREATE A NEW BLOCK

By: Didier Carne

LGT Champollion – Figeac

dcarne@ac-toulouse.fr

Files to Download

https://github.com/taweili/ardublock

Files to change

  1. “ardublock.xml” in src/main/resources/com/ardublock/block contains a description of the GUI module contains its location in a menu
  2. “ardublock.properties” in src/main/resources/com/ardublock/block contains the definition text to display in the GUI
  3. “ardublock_fr.properties” in src/main/resources/com/ardublock/block contains the definition text to display in the GUI in French
  4. “TranslatorBlockFactory” in src/main/java/com/ardublock/translator/block to associate the code to generate with the GUI module

Files to create

  1. create a class in a java file in src/main/java/com/ardublock/translator/block creates the code to be generated for the module

Changes and ADDS in A FILE

 

  1. ardublock.xml
    • add a “BlockGenus”
      • with “name” used to identify the block, used in the filer “TranslatorBlockFactory”
      • with “kind” which defines the type of GUI
      • with “initlabel” which sets the text to display in the module
      • then put a “BlockConnector” for setting the I/O of the module
      • then put a reference to a picture, if necessary
      • com/ardublock/block/champodc/DFR0009-100×100.jpg
    • place the created module in a menu
      1. df_lcd_keypad
    • or create a new menu if necessary
      1. add in ardublock.xml
      2. ——————
      3. and lower
      4. df_lcd_keypad
      5. in ardublock.properties
      6. ————————-
      7. bd.champo=CHAMPOL
      8. in TranslatorBlockFactory
      9. —————————
      10. //CHAMPOL
      11. if (blockName.equals …..
  2. 2- ardublock.properties
  3. ———————–
  4. as for the menu, add bg.df_lcd_keypad=DFRobot LCD Keypad and any other useful definitions
  5. 3- ardublock_fr.properties
  6. ————————–
  7. put the French translation if necessary

CREATING A FILE

We need to create the class corresponding to new module in src/main/java/com/ardublock/translator/block or in src/main/java/com/ardublock/translator/block/champol or …

make new>class

give a name for the class

and buil it.

see other class definitions.

below is an example for the LCD Display

 

Leave a comment