Page 1 of 1

Prototype for sort-of MVC pattern for Arduino / STM32

Posted: Fri Mar 18, 2022 11:55 am
by i998
Hi All,

I believe many of us needed to make an application that, in fact, does some basic things:
- Get input from a user
- Collect data from other sources like sensors
- Process the information and display the results based on the data captured and/or user input provided
- Rinse and Repeat

I 've made a working prototype of a sort-of MVC pattern for Arduino / STM32 which could help with such scenarios. It has been designed to split relevant operations into three domains - Data, Control and Presentation (yes, it is not a true canonical MVC, but I hope you see an analogy here) so there are three classes in the prototype. Together with the sketch itself, it helps to decouple functions that the code performs and make easier to manage and modify the code in future. The solution overview diagram is here.

In this prototype we can:
- simulate a signal from an external sensor with a variable potentiometer (Maple Mini converts an analog read to a value from 0 to 4095 which is called "voltage" in this prototype)
- capture user input with buttons (one built-in and a couple extra ones)
- display various screens and data on a small LCD display
- and also use Serial and built-in LED to provide output to users


See https://github.com/i998/Arduino_MVC_STM32

Hope that helps.