The modeling and control of complex, non-linear, and time-changing mechatronic systems requires complex software development. They are carried out in the prototyping phase with engineering software development tools, generating models, and control algorithms that are not always easily exportable to control hardware. The following work offers an alternative that considers Model-Based Design using graphics-based languages, which facilitates programming tasks for modeling and controlling mechatronic devices and their transition from prototype to control hardware. Model-Based Design with high abstraction programming level capabilities provides the user with a fast coding and testing environment, suitable for laboratory prototyping and subsequent transfer to commercial embedded controllers. The proposed solution combines control hardware based on an STM32H7 microcontroller and a software development environment using graphics-based languages developed for MATLAB. The result is a solution that integrates control hardware and software in a hardware-in-the-loop paradigm. This solution provides robust and energy-saving controllers and demonstrates that an advanced control algorithm can be set up in a critical safety-compliant low-cost embedded controller via a custom model-based design. Algorithms and tools are transferred to the controller without losing the advantages gained in the prototyping phase. Finally, experimental results implementing an adaptive controller in a DC motor and in a pneumatic system are shown to validate the system.