How technologiescollege/blockly-at-rduino works
Main Components
• Web User Interface (UI): Represented by the HTML files (e.g., index.html, index_AIO.html, index_IDE.html) and styled using CSS (in the “css” folder). This is where users interact with the drag-and-drop Blockly environment.
• Blockly Core & Customization: The “core” directory holds custom integrations with Blockly (e.g., integration files like block_instance.js, field_instance.js, type definitions, and other Blockly-related engine code). Also, the “lang” and “toolbox” directories supply multi-language support and necessary block tool definitions.
• Block Definitions: The “blocks” directory contains a multitude of subdirectories, each dedicated to particular modules or functionalities (such as sensor libraries, communication modules, and brand-specific blocks like “Adafruit”, “DFRobot”, “Robobox”, etc.). This clearly shows an extensive modular design for different hardware components.
• Code Generators: In the “generators” folder, there are subdirectories like “Blockly”, “BlocklyArduino”, “arduino”, “python”, etc. These are responsible for producing the final code (e.g., Arduino code and Python code) from the visual configuration.
• Examples & Documentation: The “examples” and “documentation” directories house sample projects and guides that help users understand how to use various blocks and functionalities.
• Developer Tools & Auxiliary Applications: The “tools” directory includes resources for RGB configuration interfaces, IoT web servers, and even serial console and supervision tools. These support extended functionalities like uploading code and live supervision via the PyMata-AIO server.
• External Interfaces: The README indicates optional Electron-based versions which provide advanced features such as local serial console and firmware upload. These should be represented as optional modules interfacing with the core application.
Relationships and Interactions
• The user interacts with the Web UI (frontend), and the UI leverages the Blockly framework (enhanced by additional “core” components) to allow visual programming.
• Custom blocks are defined in the “blocks” directory; when the user assembles these blocks, the corresponding XML configuration is processed.
• The ‘generators’ then translate the visual block configuration into executable Arduino code.
• Users can save and load projects (through XML/INO files) and, when ready, utilize integrated tools (from “tools” and separate Electron version) to upload the code to the Arduino board or monitor it via a serial console.
• There is a data flow from UI → Blockly engine → Code generators → Arduino hardware (potentially via serial data and real-time supervision provided by PyMata-AIO).
Important Architectural Patterns/Design Principles
• Modular Architecture: Notice how the blocks are separated by categories (for different hardware devices and brand-specific modules). This modular design supports extensibility.
• Separation of Concerns: The project clearly separates the UI, block definitions, code generation, and hardware interfacing layers.
• Multi-language Support: The “lang” directory shows that the system is designed with internationalization in mind, enabling different language versions.
• Extensibility/Plugin Support: The architecture supports the addition of new blocks and generators, as indicated by the many different sub-directories and extensible toolbox definitions.
Relevant Technologies and Frameworks
• Frontend: HTML, CSS, and JavaScript (with JQuery for certain UI elements, as observed in the “libs” folder).
• Blockly Library: A core dependency for the drag-and-drop block programming.
• Arduino IDE Compatibility: The generated Arduino code is designed to be copy-paste–ready for the Arduino IDE.
• Additional Libraries: Canvas2Image, Smoothie charts, and others in “core/libs” indicate usage of libraries for handling UI dynamics and possibly real-time charting (especially pertinent in the supervision tools).
Detailing Important Architectural Elements
• Provide any data stores (for saving XML or INO files) as part of “Storage” elements.
• Showing a feedback loop for real-time supervision where data from the Arduino (via PyMata-AIO) is fed back to the web UI.
Happy diagramming!