B4R Question PCF8574 library and ESP32

Mostez

Well-Known Member
Licensed User
Longtime User
I tried to run this PCF8574 example on ESP32S board but failed to compile the code, is it possible to use this library with ESP32? if yes, kindly provide simple example code.

I tried different initialization,

B4X:
pcf.Initialize(0x20,pcf.I2C_Wire2) 'also tried Wire and Wire1
pcf.begin(21,22,0xFF) 'ESP I2C pins

TIA
 

candide

Active Member
Licensed User
normally on esp32 wire0 is the first and wire1 is the second.

for first wire on esp32:
pfc.Initialize(0x20,pcf.I2C_Wire0);
pfc.begin1(0xFF)

and SDA by default is GPIO 21 / SCL by default is GPIO 22
 
Upvote 0

Mostez

Well-Known Member
Licensed User
Longtime User
I2C_Wire0 is not exist, however I tried (begin1) method with no hope, I changed to Arduino Nano but it failed too!
 
Upvote 0

candide

Active Member
Licensed User
in fact, management of I2C was not correct for esp32

can you check this version ? i hope it is better.
 

Attachments

  • rPCF8574_lib.zip
    5.5 KB · Views: 139
  • rPCF8574_B4R.zip
    1.9 KB · Views: 130
Upvote 0

Mostez

Well-Known Member
Licensed User
Longtime User
compiled OK, and the led blinked OK too. did not test the keys relevant code yet.
Thank you for your great efforts.
 
Upvote 0
Top