Abstractions can be used to maintain flexibility in platform choice, while keeping the application itself unchanged
The first image shows an example application that toggles four LEDs. While the platform is unspecified, the application uses abstractions—specifically the OutputBool interface—to control the LEDs by turning them on and off
The second image shows a platform-specific implementation using the Win32 API
The third image shows the output displayed on the laptop screen. The LEDs intermittently display their colors
The fourth image illustrates the platform-specific implementation for the LEDs on the STM32F429I-DISC1 development board.
Note that a physical connection to the board is not required to compile and run the code successfully (See LED3 and LED4).