One thing that strikes me is the blocks nearly melting into each other making it hard to follow the logic. Visually the code more or less just continues downwards, without looping. I guess this design for good looks, but for readability (less confusing for a newbie too) a much clearer gap around individual loops would help see into it. I think.
Why mainloopvar?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The Do-Loop implement in the latest build has a simpler construct in the latest build. A DO-LOOP is a block that makes the program repeat a task, like replaying a game level.
The Shape of a Simple DO-LOOP Block. It’s a tall rectangle with a tab on top and a slot below:
Repeats actions inside it, e.g., saying "Hi!" multiple times.
The simplest version (do_loop_simplest) repeats forever until stopped.
In the latest build all Blocks now have a Black line edge. Makes them a lot easier to see.
The UI is a MIT/Google defined. I want to ensure the colors/shapes comply with the standards. I can tweak things like the Black edge via the defined CSS file.
The mainloop var? These are development photos and the variable has no meaning.
Much better. The border is a very good workaround and the loop command at the end of the loop makes it easier to understand the code.
I don't understand what mytimer does inserted to the right of wait in the repeats, why on the side?
I agree it is a good idea following the standard. Still, a little less cute and a little more clarity (more linear) would have been nice, but it is probably not easy to convince MIT/Google of that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So if there is a variable (enabled) use its value instead. Ok. Needs explaining, but practical, yes. Good thing.
I think the interface is pretty easy to follow now. The black borders and the end repeat / loop at the end of the loops, made a big difference. Thumbs up!
Last edit: Roger Jönsson 2025-06-07
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Introducing Blockly for GCBASIC: Visual Programming for Microcontrollers
I am excited to announce Blockly for GCBASIC - a visual programming interface that brings drag-and-drop functionality to microcontroller development.
Why Replace Graphical GCBASIC?
Whilst Graphical GCBASIC served the community well, Blockly for GCBASIC represents a step forward in visual programming capabilities. Here is why I am making this transition:
Modern Web-Based Interface: Built on Google's Blockly framework, this solution offers a cross-platform experience that works in modern web browsers.
Enhanced User Experience: The drag-and-drop interface makes programming more accessible to beginners whilst remaining suitable for advanced users. No more wrestling with complex GUI layouts or platform-specific installation issues.
Future-Proof Architecture: By leveraging Blockly's foundation, this approach ensures better long-term maintainability and the ability to incorporate new features as the ecosystem evolves.
Use Cases for GCBASIC Blockly
Educational Environments: Suitable for teaching programming concepts in schools and universities. Students can focus on logic and problem-solving without getting caught up in syntax details. Teachers can demonstrate programming concepts visually, making abstract ideas more concrete for learners.
Rapid Prototyping: Assemble and test microcontroller programmes for proof-of-concept projects. The visual nature makes it easier to experiment with different approaches. Engineers and hobbyists can iterate through design concepts more quickly than traditional text-based coding.
Maker Projects: Whether you are building home automation systems, robotics projects, or IoT devices, Blockly for GCBASIC makes microcontroller programming accessible to makers of various skill levels. The visual approach helps bridge the gap between creative ideas and technical implementation.
Embedded System Development: From simple LED controllers to multi-sensor systems, the visual interface helps manage programme flow and hardware interactions. System architects can visualise the overall programme structure more clearly.
Research and Development: Academic researchers can focus on their experiments rather than wrestling with low-level programming details, whilst still having access to GCBASIC functionality. This allows more time for the actual research and less time debugging syntax errors.
Professional Training: The visual interface can help train new employees on microcontroller programming concepts. The graphical representation makes it easier to understand control logic and system interactions.
Accessibility: Programmers with certain learning differences or visual processing preferences may find the block-based approach more intuitive than traditional text-based coding.
Development Status
Currently in early alpha phase, and I am pleased to report progress:
✅ Core Foundation Complete: The basic Blockly engine is operational and integrated with GCBASIC compilation.
✅ Major Challenges Resolved: The difficult architectural problems have been solved, including block-to-code translation, hardware abstraction, and compilation pipeline integration.
✅ Basic Functionality Working: Essential programming blocks for variables, loops, conditionals, and basic I/O operations are functional and tested.
What is Next: I am now focusing on expanding the block library, improving the user interface, and adding more microcontroller-specific features. Priority areas include enhanced debugging capabilities, custom block creation tools, and documentation.
Blockly for GCBASIC UI
Current Capabilities
The alpha version supports fundamental programming constructs including variable declarations, mathematical operations, conditional statements, and loop structures.
Basic GPIO operations, timer functions, and serial communication blocks are operational and producing correct GCBASIC code output is next.
Join the Development
This is a good time to get involved with Blockly for GCBASIC. Whilst in early alpha, the foundation is solid and ready for community feedback and contributions.
The transition from Graphical GCBASIC to Blockly represents a technology upgrade making microcontroller programming more accessible for a wider community.
Your feedback during this early phase will be valuable in shaping the final product. Whether you are an educator, professional developer, or hobbyist maker, your input will help ensure Blockly for GCBASIC meets real-world needs.
Interested in trying the early alpha or contributing to development? Contact me for access and information.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have updated the host solution to auto-load an example project. This means you can select the Generate Code button and you can experience the code generation - no blank workspace to start with.....
You can create you projects, save, re-open and import existing blocks.
The initial project is a LCD project.
This is alpha development. If someone wants to change to automatically compile and program that is doable.
Cute, fun.
Even though I'm an old (actually very old) school programmer.
So old school that I once programmed in Fortran on a Digital PDP11-84.
I like playing with these things, I'll play with it a bit...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The process is relatively simple. You need to know the output expect. You define the Blocks, you define the output from the Blocks and it works. It is way more complex in reality but this is the high level process.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The latest build has Logic blocks, plus many Maths blocks from the last few days.
Blockly Diagram Description for GCBASIC Blockly - Build 06092025 11:45
Hello fellow GCBASIC enthusiasts!
Sharing a snapshot of the current Blockly workspace from the GCBASIC Blockly project (build 06092025 11:45). This picture showcases a well-constructed program designed for a PIC microcontroller, leveraging the visual block-based interface to generate GCBASIC code.
Let me break it down:
Workspace Overview
Interface: The workspace features the Blockly grid with a toolbox on the left, categorised into sections like Setup, Logic, Math, Variables, Loops, Text, Commands, and Containers. The main workspace displays a series of interconnected blocks, each with distinct colours indicating their category.
Build Info: The header displays BLOCKLY for GCBASIC - build 06092025 11:45, reflecting the latest development snapshot.
Block Structure
The program is built with a nested hierarchy of blocks, demonstrating control flow, variable manipulation, and I/O operations:
Setup Blocks:
A select_chip block (orange) sets the target microcontroller to "16F877A".
A constant_block_group (green) defines LCD control constants (e.g., LCD_RS, LCD_ENABLE) with comments.
A variable_block_group (pink) declares global variables like myTimer (Word), myCounter (Byte), myVar (Byte), and myString (String * 10).
Main Logic:
The program starts with a do_loop_simplest block (yellow), creating an infinite loop labeled "Main loop - runs forever."
Inside this loop, a repeat_loop_simple block (yellow) repeats actions 2 times.
An if_then_else block (purple) checks if myCounter = 0:
Then Branch: Executes Print "GCBASIC#1" and Wait 500 ms.
Else Branch: Executes Print "GCBASIC#2" and Wait 500 ms.
A set_variable block (pink) sets myCounter = 0 to reset the counter.
Another repeat_loop_simple block repeats 2 times, containing:
A print_text block (yellow) outputs myString.
A wait_fixed block (blue) waits for myTimer ms with a comment noting variable or constant use.
An lcd_cls block (blue) clears the LCD.
Variable Manipulation:
A set_variable block sets myVar = 0.
A math_operation block (blue) calculates myCounter + 1 and updates myCounter.
Generated GCBASIC Code
The right-hand pane displays the compiled GCBASIC code, automatically generated from the blocks:
Variables: Declares myTimer, myCounter, myVar, and myString with initial values.
Main Program: Includes a Do loop with the If structure, Print and Wait commands, and variable updates, ending with Loop.
Observations
Comments: Blocks like constant_block_group and wait_fixed include comments (e.g., "This is an example group..." and "Uses either the constant..."), which are formatted in the code.
Nesting: The nested loops and conditional statements demonstrate the power of Blockly for complex logic.
Interactivity: The control buttons (Generate Code, Import Blocks, etc.) and console outputs (System Log, GCBASIC Output) are visible, indicating a fully functional environment.
This diagram highlights the versatility of GCBASIC Blockly for creating microcontroller programs visually. Feel free to experiment with the blocks, share your designs, or report any issues via the GitHub Issues page. Looking forward to your feedback!
Restored 'Load Imported' - deleted in error when removing errant dropdown.
Add Group control to Constants Group Container
Changed set_variable block to use inline inputs with a text field instead of a value input.
Changed math_modulo block to use inline text inputs instead of value inputs.
Implement changlog
Implement changelog popup with version control
Removed the errant dropdown at the bottom of the page
Implement comments. Blocks can have comments added. These commments, when appropiate, are formatted and added to the GCBASIC. Very hard to implement. If you think other Blocks need the comments exposing - just ask.
Blocks that are not fully suportted have been hidden
Loading XML with comments now supported
The wait command is even smarter. Variables can be disabled)
This guide provides a straightforward, local installation of GCBASIC for Blockly, allowing you to run it seamlessly on your system. By using Python’s built-in http.server, you can create a lightweight web server to host Blockly files without any complex setup.
The process is simple:
1. Install Python.
2. Copy Blockly files to a directory.
3. Start a local web server with a single command.
Follow this guide to quickly set up your GCBASIC_Blockly.html project and begin experimenting with Blockly in a controlled environment.
Python's http.server is a built-in module that allows you to create a simple HTTP server to serve files from a directory. It provides a lightweight way to host static files, such as HTML, JavaScript, and CSS, over a network or locally.
Purpose: Ideal for testing, development, and quick file sharing.
Limitations: Not recommended for production use due to lack of security features, performance optimization, or scalability.
Why Use a Simple HTTP Server in Python?
Using a simple HTTP server in Python offers several advantages for working with Blockly and your GCBASIC_Blockly.html project:
Easy File Sharing – Share your Blockly workspace with others on the same network without configuring a complex server. Access it via a local IP (e.g., http://192.168.1.x:8000/GCBASIC_Blockly.html).
Quick Testing – Test your Blockly application locally without needing Apache, Nginx, or other web server installations, speeding up development cycles.
Development Convenience – Serve files from any directory for local debugging, allowing real-time edits to HTML and JavaScript files with immediate browser reflection.
Cross-Platform – Works on Windows, macOS, and Linux with Python installed, making it universally accessible.
How to Start a Server (Install)
Setting up a Python HTTP server is low-risk and requires minimal effort. Follow these steps:
Install Python:
Download and install Python from the official site (Python.org) or your package manager (e.g., apt, brew).
Ensure Python 3.x is installed (e.g., check with python3 --version or python --version).
This process is safe and reversible, with no system-level changes required.
Copy Files to a Folder:
Create a dedicated directory (e.g., BlocklyProject).
Copy your GCBASIC_Blockly.html file and any associated text files (e.g., my_blockly_project.xml, changelog.txt, GCBASIC_Blockly_Guide.md) into this folder. See the File Listing for details.
Open a Command Prompt:
Navigate to the folder using a terminal or command prompt:
Windows: cd path\to\BlocklyProject
macOS/Linux: cd /path/to/BlocklyProject
Ensure you’re in the correct directory before proceeding.
How to Start a Server (One-liner)
To start a simple HTTP server in Python, use this one-liner command in your terminal or command prompt:
python -m http.server 8000
How to Access the Server (One-liner)
After running the server, access your Blockly setup in a browser using:
http://localhost:8000/GCBASIC_Blockly.html
Best Place to Download Python
The best place to download Python is the official Python website: Python.org. It provides the latest stable releases for Windows, macOS, and Linux, along with installation guides and documentation.
Alternatively, if you're using Windows, you can also download Python from the Microsoft Store: Python 3.11.
Last edit: Anobium 2025-06-12
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Welcome to GCBASIC for Blockly, where programming meets visual simplicity and modular design. This guide introduces how to create, refine, and share Blockly-based solutions, making collaboration effortless.
Instead of writing complex manual code, Blockly allows developers to drag-and-drop logical blocks, simplifying embedded programming. By sharing structured solutions, users can reuse, refine, and optimise existing logic, accelerating project development.
Why Share Blockly Solutions?
Encourage Reusability – Reuse optimised solutions across multiple projects.
Improve Collaboration – Share structured blocks for community-driven enhancements.
Enhance Learning – Provide beginners with structured examples that build programming confidence.
Standardise Workflows – Ensure consistency in embedded programming practices.
Downloadable XML Files: Overview
The downloadable XML files contain a pre-configured Blockly workspace, designed for easy importing and extension.
Key Features:
✅ Contains ready-to-use Blockly logic, structured for embedded microcontrollers.
✅ Allows fast modification, enabling developers to tweak logic without starting from scratch.
✅ Ensures block positioning is preserved, maintaining workspace organisation on reload.
Summary of GCBASIC Blockly XML
This XML file includes a set of predefined blocks to handle timing, conditions, and structured execution flows. It enables developers to work with fixed delays, conditional waits, and customised annotations within Blockly. The workspace is optimised for microcontroller programming, ensuring efficient code execution while keeping the logic visually organised.
Expanding Shared Solutions Further
Integrate Blockly solutions into GCBASIC projects, ensuring compatibility with embedded systems and microcontrollers.
Version control your Blockly XML files, allowing a structured approach for updates, modifications, and improvements.
Encourage open-source contributions, enabling widespread adoption of efficient Blockly-based logic.
Existing Online Demos
Here are preconfigured Blockly demos available for testing:
GCBASIC for Blockly Capabilities from a User's Perspective
Key Points
GCBASIC for Blockly provides a visual, drag-and-drop interface for programming microcontrollers such as PIC, AVR, and LGT, ideal for beginners.
It supports over 1300 chips, with features for code generation, project management, and error handling.
The tool includes logic blocks, loops, variables, and subroutines, enhancing programming flexibility.
It is user-friendly, offering demonstrations, guides, and a customisable workspace for learning and projects.
Visual Programming and Microcontroller Support
GCBASIC for Blockly offers a visual programming environment where users can create GCBASIC code by dragging and dropping blocks, making it accessible for those new to programming. It supports a wide range of microcontrollers, including PIC, AVR, and LGT, with over 1300 chips available for selection through a searchable dropdown, ensuring compatibility with various hardware, such as PIC16F877A and ATmega328P.
Block Library and Code Generation
The toolbox is organised into categories such as Setup, Constants, Logic, Math, Variables, Loops, Text, Lists, Subroutines, Commands, and Containers, covering essential programming needs. Users can generate well-formatted GCBASIC code from these blocks, which can be exported for use in the GCBASIC IDE or other environments, with sections for chip selection, constants, variables, main programme, subroutines, and tables, ensuring readability.
Project Management and User Experience
Users can import and export projects as XML files, allowing them to save and load their work easily. The interface includes error checking, logging, and dynamic features such as validating references, ensuring a smooth experience. The workspace is customisable, with options to toggle the grid, resize, and zoom, and it features a tabbed interface for viewing generated code.
Educational and Practical Tools
I have designed the tool to include demonstrations (for example, LCD, ADC, motor control) and a dynamic guide (GCBASIC Blockly Guide). It supports features such as subroutines, tables, and logic blocks, catering to both simple and complex projects. Demonstrations are available at GCBASIC Blockly Examples.
Detailed Capabilities of GCBASIC for Blockly from a User's Perspective
GCBASIC for Blockly is a robust visual programming tool built on the Blockly framework, designed to simplify microcontroller programming for users, particularly beginners, educators, and hobbyists. It enables the creation of GCBASIC code for microcontrollers such as PIC and AVR through an intuitive drag-and-drop interface, eliminating the need for traditional coding syntax. Below is a comprehensive overview of its capabilities, reflecting its suitability for both educational and practical applications.
Visual Programming Environment
At its core, GCBASIC for Blockly offers a visual programming interface where users can construct programs by arranging puzzle-piece-like blocks. This approach is particularly beneficial for those new to programming, as it abstracts the complexities of syntax and focuses on logic and structure. The interface is accessible, with clear labels and tooltips, making it easy for users to understand and use. The drag-and-drop functionality supports a wide range of programming concepts, from basic operations to advanced control structures, aligning with Blockly's design for educational and beginner-friendly coding (Blockly Overview).
Microcontroller Compatibility and Chip Selection
The tool supports an extensive list of microcontrollers, including PIC and AVR, with over 1300 chips available for selection. Users can choose their target chip through a searchable dropdown, which enhances usability for projects requiring specific hardware. This feature ensures that the generated GCBASIC code is tailored to the selected microcontroller, supporting devices such as PIC16F877A and ATmega328P.
Comprehensive Block Library
The toolbox is categorised into several groups, each serving distinct programming needs:
Setup: Includes blocks for selecting chips and adding decorative text or remarks, useful for project initialisation.
Constants: Allows defining configuration constants, including setting PORT constants to ON or OFF and getting their state, enhancing hardware interaction.
Logic: Features blocks for conditionals (If-Then, If-Else), comparisons, logical operations (And, Or, Not), and Boolean values, ensuring correct indentation for readability.
Math: Supports numeric operations, modulo calculations, and checks for odd/even numbers, catering to mathematical programming needs.
Variables: Enables declaration of numeric and string variables, with group containers for organising variable definitions, supporting data management.
Loops: Offers various loop structures such as For-Next, Do-While, Repeat, with handlers for missing variables and logic statement inputs, providing control flow options.
Text: Includes blocks for printing text, essential for output operations.
Lists: Supports creating and reading tables (lists) for data storage and retrieval.
Subroutines: Allows defining and calling custom subroutines, with parameters, enhancing code reusability.
Commands: Includes wait commands with variable or constant inputs, and LCD operations, for timing and display functions.
Containers: Provides snippet containers for collapsing code segments and grouping blocks, improving code organisation.
These categories ensure users have access to a broad spectrum of programming constructs, making the tool versatile for both simple and complex projects.
Code Generation and Export
Users can generate GCBASIC code from their block arrangements, which is formatted with comments and organised into sections such as chip selection, constants, global variables (numeric and string), main program, subroutines, and tables. The code can be exported as a file for use in the GCBASIC IDE or other compatible environments, facilitating integration with development workflows. Subroutines are shown last in the output, improving code readability.
Project Management and Persistence
The tool supports importing and exporting projects as XML files, allowing users to save their work and load it later. This feature is crucial for collaborative projects or resuming work. Users can also pass XML files as start parameters, enhancing flexibility (GCBASIC Blockly Demos). The system saves state locally, ensuring persistence across sessions, and includes a prompt for usernames, adding a personal touch to generated code headers.
Error Handling and Feedback
GCBASIC for Blockly includes robust error handling, with real-time validation of dropdowns (e.g., ensuring referenced tables or constants exist) and logging of errors and warnings in a dedicated console. This feedback mechanism helps users identify and resolve issues, such as undefined variables or invalid conditions, with messages displayed in colour-coded formats (e.g., red for errors, green for warnings). Console log warnings and flashing the code tab when generating code enhance user awareness.
Dynamic Features and Interactivity
The interface includes dynamic features such as a searchable chip selector, automatic validation of references, and interactive elements such as enabling/disabling fields based on block connections (e.g., wait command variables). It supports setting PORT constants and getting their state, with validation ensuring correctness. The system also supports comments for blocks, which are formatted and included in the generated code, improving documentation.
Customizable Workspace and User Experience
Users can customise the workspace by toggling the grid on or off, resizing, and zooming in/out for better visibility. The tabbed interface allows switching between the Blockly editor and the generated GCBASIC code, with a flash effect when generating code to draw attention. The workspace layout uses 90% of the browser, with a reduced banner font size for clarity, and includes a GCBASIC logo for branding, enhancing the user experience.
Educational and Practical Tools
The tool is designed with educational value in mind, offering demonstrations for LCD, ADC, motor control, and more, accessible via GCBASIC Blockly Examples. A dynamic guide (GCBASIC Blockly Guide) provides learning resources. A version control popup ensures users are informed of updates, supporting continuous learning and adoption.
Extensibility and Community Support
Built on Blockly, GCBASIC for Blockly is highly extensible, allowing advanced users to create custom blocks, though this is more relevant for developers. The tool's integration with Blockly provides access to community forums and resources, enhancing support for users (Blockly Developer Forum). URLs in the readme facilitate community engagement and resource sharing.
Accessibility and Performance
The drag-and-drop interface, combined with clear block labels and tooltips, makes the tool accessible to users with different learning styles or abilities, aligning with Blockly's commitment to inclusive tools (Blockly Accessibility). Performance optimisations, such as caching and efficient data handling, ensure smooth operation even with large projects, with zoom and auto-positioning enhancing usability.
Integration with External Resources
Users can load XML files as parameters and generate code that integrates with external IDEs or microcontrollers, enhancing its utility in real-world projects. Demonstrations showcase practical applications (GCBASIC Blockly Demos).
Security and Stability
The tool includes measures such as preventing page refreshes during a session, ensuring user work is protected. Enhanced wait commands and error handling contribute to stability, with the system logging visits for analytics, though this is more backend-focused (GCBASIC Download).
So, what is this ?
Does someone want to play ?
Last edit: Anobium 2025-06-02
One thing that strikes me is the blocks nearly melting into each other making it hard to follow the logic. Visually the code more or less just continues downwards, without looping. I guess this design for good looks, but for readability (less confusing for a newbie too) a much clearer gap around individual loops would help see into it. I think.
Why mainloopvar?
The Do-Loop implement in the latest build has a simpler construct in the latest build. A DO-LOOP is a block that makes the program repeat a task, like replaying a game level.
The Shape of a Simple DO-LOOP Block. It’s a tall rectangle with a tab on top and a slot below:
Repeats actions inside it, e.g., saying "Hi!" multiple times.
The simplest version (do_loop_simplest) repeats forever until stopped.
In the latest build all Blocks now have a Black line edge. Makes them a lot easier to see.
The UI is a MIT/Google defined. I want to ensure the colors/shapes comply with the standards. I can tweak things like the Black edge via the defined CSS file.
The mainloop var? These are development photos and the variable has no meaning.
Much better. The border is a very good workaround and the loop command at the end of the loop makes it easier to understand the code.
I don't understand what mytimer does inserted to the right of wait in the repeats, why on the side?
I agree it is a good idea following the standard. Still, a little less cute and a little more clarity (more linear) would have been nice, but it is probably not easy to convince MIT/Google of that.
Here is a different Block for the Wait. So, great feedback from you.
Case #1. The left field will take any number value.
or
Case #2. The right field will take any variable, calc etc. Note the left field is not read-only.
This an a much better approach.
Last edit: Anobium 2025-06-07
I would definitely choose case #2.
Wait [mytimer] s
or
Wait 1 s
-Makes perfect sense. Easy to follow and understand.
Wait [1 or mytimer] s
Is not actual code, is it?
Try here https://gcbasic.com/GCBASIC_Blockly.html?dl=1 Play and generate the code - you can always reset the page by reloading the page.
Wait [1 or mytimer] s
would generateWait 1 s
orWait mytimer s
. Very clever.Lots of the functionality works, some of the functionality is not yet implemented. But, this really shows what is possible!
So if there is a variable (enabled) use its value instead. Ok. Needs explaining, but practical, yes. Good thing.
I think the interface is pretty easy to follow now. The black borders and the end repeat / loop at the end of the loops, made a big difference. Thumbs up!
Last edit: Roger Jönsson 2025-06-07
Introducing Blockly for GCBASIC: Visual Programming for Microcontrollers
I am excited to announce Blockly for GCBASIC - a visual programming interface that brings drag-and-drop functionality to microcontroller development.
Why Replace Graphical GCBASIC?
Whilst Graphical GCBASIC served the community well, Blockly for GCBASIC represents a step forward in visual programming capabilities. Here is why I am making this transition:
Modern Web-Based Interface: Built on Google's Blockly framework, this solution offers a cross-platform experience that works in modern web browsers.
Enhanced User Experience: The drag-and-drop interface makes programming more accessible to beginners whilst remaining suitable for advanced users. No more wrestling with complex GUI layouts or platform-specific installation issues.
Future-Proof Architecture: By leveraging Blockly's foundation, this approach ensures better long-term maintainability and the ability to incorporate new features as the ecosystem evolves.
Use Cases for GCBASIC Blockly
Educational Environments: Suitable for teaching programming concepts in schools and universities. Students can focus on logic and problem-solving without getting caught up in syntax details. Teachers can demonstrate programming concepts visually, making abstract ideas more concrete for learners.
Rapid Prototyping: Assemble and test microcontroller programmes for proof-of-concept projects. The visual nature makes it easier to experiment with different approaches. Engineers and hobbyists can iterate through design concepts more quickly than traditional text-based coding.
Maker Projects: Whether you are building home automation systems, robotics projects, or IoT devices, Blockly for GCBASIC makes microcontroller programming accessible to makers of various skill levels. The visual approach helps bridge the gap between creative ideas and technical implementation.
Embedded System Development: From simple LED controllers to multi-sensor systems, the visual interface helps manage programme flow and hardware interactions. System architects can visualise the overall programme structure more clearly.
Research and Development: Academic researchers can focus on their experiments rather than wrestling with low-level programming details, whilst still having access to GCBASIC functionality. This allows more time for the actual research and less time debugging syntax errors.
Professional Training: The visual interface can help train new employees on microcontroller programming concepts. The graphical representation makes it easier to understand control logic and system interactions.
Accessibility: Programmers with certain learning differences or visual processing preferences may find the block-based approach more intuitive than traditional text-based coding.
Development Status
Currently in early alpha phase, and I am pleased to report progress:
✅ Core Foundation Complete: The basic Blockly engine is operational and integrated with GCBASIC compilation.
✅ Major Challenges Resolved: The difficult architectural problems have been solved, including block-to-code translation, hardware abstraction, and compilation pipeline integration.
✅ Basic Functionality Working: Essential programming blocks for variables, loops, conditionals, and basic I/O operations are functional and tested.
What is Next: I am now focusing on expanding the block library, improving the user interface, and adding more microcontroller-specific features. Priority areas include enhanced debugging capabilities, custom block creation tools, and documentation.
Blockly for GCBASIC UI
Current Capabilities
The alpha version supports fundamental programming constructs including variable declarations, mathematical operations, conditional statements, and loop structures.
Basic GPIO operations, timer functions, and serial communication blocks are operational and producing correct GCBASIC code output is next.
Join the Development
This is a good time to get involved with Blockly for GCBASIC. Whilst in early alpha, the foundation is solid and ready for community feedback and contributions.
Want to try the build, try here
The transition from Graphical GCBASIC to Blockly represents a technology upgrade making microcontroller programming more accessible for a wider community.
Your feedback during this early phase will be valuable in shaping the final product. Whether you are an educator, professional developer, or hobbyist maker, your input will help ensure Blockly for GCBASIC meets real-world needs.
Interested in trying the early alpha or contributing to development? Contact me for access and information.
News:
I have updated the host solution to auto-load an example project. This means you can select the
Generate Code
button and you can experience the code generation - no blank workspace to start with.....You can create you projects, save, re-open and import existing blocks.
The initial project is a LCD project.
This is alpha development. If someone wants to change to automatically compile and program that is doable.
Your feedback is important.
Enjoy.
Last edit: Anobium 2025-06-07
Want to try the build, try it https://gcbasic.com/GCBASIC_Blockly.html?dl=1
Cute, fun.
Even though I'm an old (actually very old) school programmer.
So old school that I once programmed in Fortran on a Digital PDP11-84.
I like playing with these things, I'll play with it a bit...
I am sure you can write a Fortran version!!!
The process is relatively simple. You need to know the output expect. You define the Blocks, you define the output from the Blocks and it works. It is way more complex in reality but this is the high level process.
News
The latest build has Logic blocks, plus many Maths blocks from the last few days.
Blockly Diagram Description for GCBASIC Blockly - Build 06092025 11:45
Hello fellow GCBASIC enthusiasts!
Sharing a snapshot of the current Blockly workspace from the GCBASIC Blockly project (build 06092025 11:45). This picture showcases a well-constructed program designed for a PIC microcontroller, leveraging the visual block-based interface to generate GCBASIC code.
Let me break it down:
Workspace Overview
Interface: The workspace features the Blockly grid with a toolbox on the left, categorised into sections like Setup, Logic, Math, Variables, Loops, Text, Commands, and Containers. The main workspace displays a series of interconnected blocks, each with distinct colours indicating their category.
Build Info: The header displays
BLOCKLY for GCBASIC - build 06092025 11:45
, reflecting the latest development snapshot.Block Structure
The program is built with a nested hierarchy of blocks, demonstrating control flow, variable manipulation, and I/O operations:
Setup Blocks:
select_chip
block (orange) sets the target microcontroller to"16F877A"
.constant_block_group
(green) defines LCD control constants (e.g.,LCD_RS
,LCD_ENABLE
) with comments.variable_block_group
(pink) declares global variables likemyTimer (Word)
,myCounter (Byte)
,myVar (Byte)
, andmyString (String * 10)
.Main Logic:
do_loop_simplest
block (yellow), creating an infinite loop labeled "Main loop - runs forever."repeat_loop_simple
block (yellow) repeats actions 2 times.if_then_else
block (purple) checks ifmyCounter = 0
:Print "GCBASIC#1"
andWait 500 ms
.Print "GCBASIC#2"
andWait 500 ms
.set_variable
block (pink) setsmyCounter = 0
to reset the counter.repeat_loop_simple
block repeats 2 times, containing:print_text
block (yellow) outputsmyString
.wait_fixed
block (blue) waits formyTimer ms
with a comment noting variable or constant use.lcd_cls
block (blue) clears the LCD.Variable Manipulation:
set_variable
block setsmyVar = 0
.math_operation
block (blue) calculatesmyCounter + 1
and updatesmyCounter
.Generated GCBASIC Code
The right-hand pane displays the compiled GCBASIC code, automatically generated from the blocks:
#DEFINE LCD_RS PORTB.4
).myTimer, myCounter, myVar, and myString
with initial values.Do
loop with theIf
structure,Print
andWait
commands, and variable updates, ending withLoop
.Observations
constant_block_group
andwait_fixed
include comments (e.g.,"This is an example group..."
and"Uses either the constant..."
), which are formatted in the code.Generate Code, Import Blocks, etc.
) and console outputs (System Log, GCBASIC Output
) are visible, indicating a fully functional environment.This diagram highlights the versatility of GCBASIC Blockly for creating microcontroller programs visually. Feel free to experiment with the blocks, share your designs, or report any issues via the GitHub Issues page. Looking forward to your feedback!
Version 06.09.2025.02
** Version 06.08.2025.0G**
GCBASIC Code generated
For Developers - you need a GitHub account
Bug Tracking and enhancements - please use this link:
Report an Issue and request an enhancement
Discussions - please use this link: GitHub GCBASIC Blockly discussion
If you do not have a GitHub Account, create one, then use the URL above.
Or, post to this GCBASIC Forum post.
Last edit: Anobium 2025-06-09
the github 'discussion' link is 404'ed
You need a GitHub account.
No you do not need a GitHub account to see the GitHub URL... I spotted that I had made the repository Private.. it is not Public
News
Just added For-Next loop.
I can add For-Conditional Exit For-Next if required.
Tables and Functions support will be very comprehensive implementation.
Any other commands can be added as required.
Evan
News
Lots more added but this is the baseline functionality. This needs someone to want to use this to drive the overall solution.
Version 06.10.2025.01
Now looks pretty cool.
Last edit: Anobium 2025-06-10
News.
Table definition and ReadTable added.
Not may reviewers to date. :-(
Was it all worth it?
GCBASIC Blockly Project Guide
Introduction
This guide provides a straightforward, local installation of GCBASIC for Blockly, allowing you to run it seamlessly on your system. By using Python’s built-in
http.server
, you can create a lightweight web server to host Blockly files without any complex setup.The process is simple:
1. Install Python.
2. Copy Blockly files to a directory.
3. Start a local web server with a single command.
Follow this guide to quickly set up your GCBASIC_Blockly.html project and begin experimenting with Blockly in a controlled environment.
Table of Contents
http.server
?What is Python's
http.server
?Python's
http.server
is a built-in module that allows you to create a simple HTTP server to serve files from a directory. It provides a lightweight way to host static files, such as HTML, JavaScript, and CSS, over a network or locally.Why Use a Simple HTTP Server in Python?
Using a simple HTTP server in Python offers several advantages for working with Blockly and your
GCBASIC_Blockly.html
project:http://192.168.1.x:8000/GCBASIC_Blockly.html
).How to Start a Server (Install)
Setting up a Python HTTP server is low-risk and requires minimal effort. Follow these steps:
apt
,brew
).python3 --version
orpython --version
).This process is safe and reversible, with no system-level changes required.
Copy Files to a Folder:
BlocklyProject
).Copy your
GCBASIC_Blockly.html
file and any associated text files (e.g.,my_blockly_project.xml
,changelog.txt
,GCBASIC_Blockly_Guide.md
) into this folder. See the File Listing for details.Open a Command Prompt:
cd path\to\BlocklyProject
cd /path/to/BlocklyProject
How to Start a Server (One-liner)
To start a simple HTTP server in Python, use this one-liner command in your terminal or command prompt:
How to Access the Server (One-liner)
After running the server, access your Blockly setup in a browser using:
Best Place to Download Python
The best place to download Python is the official Python website: Python.org. It provides the latest stable releases for Windows, macOS, and Linux, along with installation guides and documentation.
Alternatively, if you're using Windows, you can also download Python from the Microsoft Store: Python 3.11.
Last edit: Anobium 2025-06-12
GCBASIC for Blockly - Demo Guide
Introduction: Sharing Blockly Solutions
Welcome to GCBASIC for Blockly, where programming meets visual simplicity and modular design. This guide introduces how to create, refine, and share Blockly-based solutions, making collaboration effortless.
Instead of writing complex manual code, Blockly allows developers to drag-and-drop logical blocks, simplifying embedded programming. By sharing structured solutions, users can reuse, refine, and optimise existing logic, accelerating project development.
Why Share Blockly Solutions?
Downloadable XML Files: Overview
The downloadable XML files contain a pre-configured Blockly workspace, designed for easy importing and extension.
Key Features:
✅ Contains ready-to-use Blockly logic, structured for embedded microcontrollers.
✅ Allows fast modification, enabling developers to tweak logic without starting from scratch.
✅ Ensures block positioning is preserved, maintaining workspace organisation on reload.
Summary of GCBASIC Blockly XML
This XML file includes a set of predefined blocks to handle timing, conditions, and structured execution flows. It enables developers to work with fixed delays, conditional waits, and customised annotations within Blockly. The workspace is optimised for microcontroller programming, ensuring efficient code execution while keeping the logic visually organised.
Expanding Shared Solutions Further
Existing Online Demos
Here are preconfigured Blockly demos available for testing:
🔗 My Blockly Project
🔗 ADC to LCD Demo
🔗 LCD Test Demo
Downloads
This section provides access to prebuilt Blockly solutions, ready for use in GCBASIC projects.
GCBASIC Blockly XML File
This is the default XML file that contains a pre-configured Blockly workspace, designed for microcontroller programming.
🔗 Download GCBASIC Blockly XML
Other Downloads
🔗 Download LCD operations demonstration
Would you like to include additional XML files, example projects, or supporting documentation here?
🚀 Let me know what you’d like to add!
GCBASIC for Blockly Demos
Explore the collection of GCBASIC for Blockly projects in XML format. See https://www.gcbasic.com/GCBASIC_Blockly_Examples.html
All the demos are now listed automatically. Just clck to open.
Enjoy... with the corrected URL
GCBASIC for Blockly updated
Explore the new demo GCBASIC for Blockly projects. See https://www.gcbasic.com/GCBASIC_Blockly_Examples.html for the new Robot Controller.
The GCBSASIC for Blocky tool has new features:
All very logical.
Evan
GCBASIC for Blockly Capabilities from a User's Perspective
Key Points
Visual Programming and Microcontroller Support
GCBASIC for Blockly offers a visual programming environment where users can create GCBASIC code by dragging and dropping blocks, making it accessible for those new to programming. It supports a wide range of microcontrollers, including PIC, AVR, and LGT, with over 1300 chips available for selection through a searchable dropdown, ensuring compatibility with various hardware, such as PIC16F877A and ATmega328P.
Block Library and Code Generation
The toolbox is organised into categories such as Setup, Constants, Logic, Math, Variables, Loops, Text, Lists, Subroutines, Commands, and Containers, covering essential programming needs. Users can generate well-formatted GCBASIC code from these blocks, which can be exported for use in the GCBASIC IDE or other environments, with sections for chip selection, constants, variables, main programme, subroutines, and tables, ensuring readability.
Project Management and User Experience
Users can import and export projects as XML files, allowing them to save and load their work easily. The interface includes error checking, logging, and dynamic features such as validating references, ensuring a smooth experience. The workspace is customisable, with options to toggle the grid, resize, and zoom, and it features a tabbed interface for viewing generated code.
Educational and Practical Tools
I have designed the tool to include demonstrations (for example, LCD, ADC, motor control) and a dynamic guide (GCBASIC Blockly Guide). It supports features such as subroutines, tables, and logic blocks, catering to both simple and complex projects. Demonstrations are available at GCBASIC Blockly Examples.
Detailed Capabilities of GCBASIC for Blockly from a User's Perspective
GCBASIC for Blockly is a robust visual programming tool built on the Blockly framework, designed to simplify microcontroller programming for users, particularly beginners, educators, and hobbyists. It enables the creation of GCBASIC code for microcontrollers such as PIC and AVR through an intuitive drag-and-drop interface, eliminating the need for traditional coding syntax. Below is a comprehensive overview of its capabilities, reflecting its suitability for both educational and practical applications.
Visual Programming Environment
At its core, GCBASIC for Blockly offers a visual programming interface where users can construct programs by arranging puzzle-piece-like blocks. This approach is particularly beneficial for those new to programming, as it abstracts the complexities of syntax and focuses on logic and structure. The interface is accessible, with clear labels and tooltips, making it easy for users to understand and use. The drag-and-drop functionality supports a wide range of programming concepts, from basic operations to advanced control structures, aligning with Blockly's design for educational and beginner-friendly coding (Blockly Overview).
Microcontroller Compatibility and Chip Selection
The tool supports an extensive list of microcontrollers, including PIC and AVR, with over 1300 chips available for selection. Users can choose their target chip through a searchable dropdown, which enhances usability for projects requiring specific hardware. This feature ensures that the generated GCBASIC code is tailored to the selected microcontroller, supporting devices such as PIC16F877A and ATmega328P.
Comprehensive Block Library
The toolbox is categorised into several groups, each serving distinct programming needs:
These categories ensure users have access to a broad spectrum of programming constructs, making the tool versatile for both simple and complex projects.
Code Generation and Export
Users can generate GCBASIC code from their block arrangements, which is formatted with comments and organised into sections such as chip selection, constants, global variables (numeric and string), main program, subroutines, and tables. The code can be exported as a file for use in the GCBASIC IDE or other compatible environments, facilitating integration with development workflows. Subroutines are shown last in the output, improving code readability.
Project Management and Persistence
The tool supports importing and exporting projects as XML files, allowing users to save their work and load it later. This feature is crucial for collaborative projects or resuming work. Users can also pass XML files as start parameters, enhancing flexibility (GCBASIC Blockly Demos). The system saves state locally, ensuring persistence across sessions, and includes a prompt for usernames, adding a personal touch to generated code headers.
Error Handling and Feedback
GCBASIC for Blockly includes robust error handling, with real-time validation of dropdowns (e.g., ensuring referenced tables or constants exist) and logging of errors and warnings in a dedicated console. This feedback mechanism helps users identify and resolve issues, such as undefined variables or invalid conditions, with messages displayed in colour-coded formats (e.g., red for errors, green for warnings). Console log warnings and flashing the code tab when generating code enhance user awareness.
Dynamic Features and Interactivity
The interface includes dynamic features such as a searchable chip selector, automatic validation of references, and interactive elements such as enabling/disabling fields based on block connections (e.g., wait command variables). It supports setting PORT constants and getting their state, with validation ensuring correctness. The system also supports comments for blocks, which are formatted and included in the generated code, improving documentation.
Customizable Workspace and User Experience
Users can customise the workspace by toggling the grid on or off, resizing, and zooming in/out for better visibility. The tabbed interface allows switching between the Blockly editor and the generated GCBASIC code, with a flash effect when generating code to draw attention. The workspace layout uses 90% of the browser, with a reduced banner font size for clarity, and includes a GCBASIC logo for branding, enhancing the user experience.
Educational and Practical Tools
The tool is designed with educational value in mind, offering demonstrations for LCD, ADC, motor control, and more, accessible via GCBASIC Blockly Examples. A dynamic guide (GCBASIC Blockly Guide) provides learning resources. A version control popup ensures users are informed of updates, supporting continuous learning and adoption.
Extensibility and Community Support
Built on Blockly, GCBASIC for Blockly is highly extensible, allowing advanced users to create custom blocks, though this is more relevant for developers. The tool's integration with Blockly provides access to community forums and resources, enhancing support for users (Blockly Developer Forum). URLs in the readme facilitate community engagement and resource sharing.
Accessibility and Performance
The drag-and-drop interface, combined with clear block labels and tooltips, makes the tool accessible to users with different learning styles or abilities, aligning with Blockly's commitment to inclusive tools (Blockly Accessibility). Performance optimisations, such as caching and efficient data handling, ensure smooth operation even with large projects, with zoom and auto-positioning enhancing usability.
Integration with External Resources
Users can load XML files as parameters and generate code that integrates with external IDEs or microcontrollers, enhancing its utility in real-world projects. Demonstrations showcase practical applications (GCBASIC Blockly Demos).
Security and Stability
The tool includes measures such as preventing page refreshes during a session, ensuring user work is protected. Enhanced wait commands and error handling contribute to stability, with the system logging visits for analytics, though this is more backend-focused (GCBASIC Download).
Summary Table of Key Capabilities
Key URLs