B4R Question ESP32 rWire problems

kolbe

Active Member
Licensed User
B4X:
B4R version: 2.00 BETA #1
Parsing code.    (0.00s)
Compiling code.    (0.01s)
Building project    (0.02s)
Compiling & deploying Ino project (Adafruit ESP32 Feather - COM11)    Error
Loading configuration...
Initializing packages...
Preparing boards...
Verifying...
C:\Users\D~1\DOCUME~1\BASIC4~3\B4R\Objects\bin\sketch\rWire.cpp: In member function 'void B4R::WireSlave::Initialize(Byte, B4R::SubVoidArray)':
rWire.cpp:33: error: 'class TwoWire' has no member named 'onReceive'
   Wire.onReceive(receiveEvent);
        ^
rWire.cpp:34: error: 'class TwoWire' has no member named 'onRequest'
   Wire.onRequest(requestEvent);
        ^
Multiple libraries were found for "WiFi.h"
Used: C:\Users\D1\Documents\Arduino\hardware\espressif\esp32\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
exit status 1

When using the rWire library with an ESP32 and B4R version 2.00 beta #1 I get this error. If I don't include the rWire library it compiles fine.
 

positrom2

Active Member
Licensed User
Multiple libraries were found for "WiFi.h"
This drove me crazy (in Arduino IDE). I had to delete any other WiFi.h file in other Arduino directories just to leave the right one referring to the used hardware. I used to delete to the recycle bin so I could restore it easily lateron. Since B4R uses Arduino system, that might be the same problem.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
You can edit rWire.cpp and change the method code to:
B4X:
  void WireSlave::Initialize(Byte Address, SubVoidArray NewDataSub) {
     instance = this;
     buffer.data = bufferData;
     buffer.length = 0;
     rcvBuffer.data = rcvBufferData;
     this->NewDataSub = NewDataSub;
#ifndef ESP32
     Wire.onReceive(receiveEvent);
     Wire.onRequest(requestEvent);
#endif
     Wire.begin(Address);
   }
This will allow you to use the ESP32 as a master.
 
Upvote 0

Similar Threads

Top