Are there other pins that can used instead of
21 and 22? as this used for many other devices
Can i program the following on ESP32?
I2C_SDA – MTDO – GPIO15
I2C_SCL – GPIO2
I2C_SDA – GPIO0
I2C_SCL – GPIO4
You can define other I2C pins other than 21 and 22.
However, I wouldn’t recommend the pins you are referring. Those are strapping pins, which means that depending on your code, if you use them for I2C, you may get unexpected results when the ESP32 boots or resets.
But you can always try and see if you get weird behavior.
You can assign any two pins as SDA/SCL using Wire.begin(SDA,SCL)
GPIO 33 and 32 are good options.
You can also check this link: https://espeasy.readthedocs.io/en/latest/Reference/GPIO.html
And scroll down to the ESP32 table to check the best pins to use.
I hope it helps.