To create a simple module in Joomla 4 we will have to follow the following steps:
We will create a new directory called mod_example. In this directory we will create the first file named mod_example.php.  This is the main file that will be accessed by Joomla and it will perform all the routines necessary to display the module.
In this file we will write the following source code:

<?php
defined('_JEXEC') or die;

use Joomla\CMS\Helper\ModuleHelper;   

require ModuleHelper::getLayoutPath('mod_exemplu', $params->get('layout', 'default')); 

The next file we will need to create is mod_example.xml. This file provides information about the module, sets the files to be uploaded and the configuration parameters of the module.
In this file we will write the following source code:

<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="4.0" client="site" method="upgrade">
    <name>Example module</name>
    <creationDate>June 2022</creationDate>
    <author>Author</author>
    <authorEmail>This email address is being protected from spambots. You need JavaScript enabled to view it.</authorEmail>
    <authorUrl>www.site-author.com</authorUrl>
    <copyright>[COPYRIGHT]</copyright>
    <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
    <version>1.0.1</version>
    <description>This is an example module</description>
    <namespace>Joomla\Module\Example</namespace>
    <files>
        <filename module="mod_example">mod_example.php</filename>
        <folder>tmpl</folder>
        <filename>mod_example.xml</filename>
    </files>
</extension>

In the next step we will create a folder called tmpl where the template files used by the module will be located. In this folder we will create the default.php file, the default file that will be accessed by Joomla automatically.
In this file we will write the following source code:

<?php
defined('_JEXEC') or die;

?>

Here is an example text made with the module <b>mod_example</b>. 

After we are done with these files we will archive the mod_example directory as a zip archive named mod_example.zip.
Then we will proceed to install this module in Joomla, after installing it we will go to the Content> Site Modules menu where we will configure the newly installed module to be visible on the site.

Animated counter

This is a personalized text

+
Lorem ipsum dolor sit amet
%
Sed ut perspiciatis unde omnis iste natus error
K
At vero eos et accusamus et iusto odio

mod_cbusshour demo

Opening hours
Monday
08:00
-
17:00
Tuesday
08:00
-
17:00
Wednesday
08:00
-
17:00
Thursday
08:00
-
17:00
Friday
09:00
-
15:00
Saturday
Free day
Sunday
Free day