Preface When you build the source code in C/C++, you might see some output messages as the blow: Flash used: 1166 of 262144 bytes (0.4%). SRAM used: 2505 of 65536 bytes (3.8%). Stack: 2048 bytes. Heap: 128 bytes. --------------- Rebuild Succeeded: 10/01/2024 17:46:40 --------------- Figure 1: The output message from PSoC Creator Figure 2: The output message from Arduino IDE Have you asked yourself what are technical jargon such as flash, stack, and heap? In short, they are kinds of memory for machines. Microcontrollers use different types of memory (Flash, SRAM, EEPROM, etc.) because each type serves a specific purpose, balancing factors like cost, speed, power consumption, and data persistence . Key Differences Between These Memory Types: The explanation for the output message in the figure 1: Flash used : 1222 of 262144 bytes (0.5%) The program's code occupies 1222 bytes of the total available 262144 bytes in Flash memory. This is a very small portion, showing efficient memory us
Let's apply the principle of C++ (object-based programming) to the task of preparing a meal. In object-based programming, we break down tasks into objects that represent real-world entities. These objects have attributes (data) and methods (actions they can perform). Example: Preparing a Meal in C++ Style Imagine you're preparing a meal with different objects, each responsible for a specific part of the process. For simplicity, let's define three main objects: Chef , Ingredients , and KitchenTools . 1. Chef Object : Attributes : Name, experience level. Methods : prepareMeal() , useTool() , mixIngredients() . 2. Ingredients Object : Attributes : Type (vegetables, meat, spices), quantity, freshness. Methods : chop() , cook() , serve() . 3. KitchenTools Object : Attributes : Tool type (knife, pan, oven), condition (new, used). Methods : cut() , heat() , stir() . C++-Style Meal Preparation Example: Here’s how we would code a meal preparation process in C++: Breakdown: The