Before writing the program, we first need to enable the I2C protocol from the Raspberry Pi configuration. To do this, open the command window and type in the following command:
sudo raspi-config
Inside configurations, open Interfacing Options, shown as follows:
Next, open the I2C option, as shown in the following screenshot:
Select the Yes option and press Enter to enable I2C, as follows:
After enabling ...