Notifications
Clear all

I2C using two ESP32 Modules Master works, Slave has errors


gameworn
(@gameworn)
Eminent Member
Joined: 2 years ago
Posts: 26
Topic starter  

Hi to all

I want to make a project that involves pushing a button an one ESP32 module and having an LED on the 2nd ESP32 module while using the I2C bus making one master and the other ESP32 the slave.

 I can  verify  the coding on the master Esp32 module, but not the slave module. The problem involves the line of code Wire.onReceive(receiveEvent); The error I get is as follows.

undefined reference to "Two Wire: : onRecveive(void(*) int() );

I have attached both  Master and Slave files. The slave board coding has a bunch of libraries that I included, not because they were required, but I was just throwing up a prayer and was trying all kinds of suggestions afforded me on  the W W W.

This project is a test project for a much larger build. I want to have the master accept inputs from joysticks and buttons, then send this down an underwater cable using I2C to the slave board which will operate an underwater ROV and its 6 motors and lights. The original package had a huge multi-conductor cable for all 6 motors for forward and reverse plus lights.

This  slave board will verify if I use an  Arduino Uno, but not the ESP32.  

Any help would be greatly appreciated, and Thank You in advance.

gameworn

 


Quote
Topic Tags
Will
 Will
(@will)
Noble Member
Joined: 1 year ago
Posts: 2018
 

@gameworn

The Wire library appears unable to use your specified pins directly. It appears to use fixed pins for its operations. This information is from the Arduino library reference for the "Wire" class at

https://www.arduino.cc/en/reference/wire

Perhaps there's a different class required for the ESP32.

I was kidnapped by mimes.
They did unspeakable things to me.


ReplyQuote
gameworn
(@gameworn)
Eminent Member
Joined: 2 years ago
Posts: 26
Topic starter  

Will

If you could excuse my ignorance, I read what you wrote and read the info from the link you sent. Could you explain all that. I read it uses addresses 0 to 7 for its data and it uses different addresses for the SDA and SCL depending on the board. If I choose other inputs/outputs, I would think it would work, but it does not. 

 


ReplyQuote
Will
 Will
(@will)
Noble Member
Joined: 1 year ago
Posts: 2018
 
Posted by: @gameworn

Will

If you could excuse my ignorance,

no problem, we're all here to learn.

I read what you wrote and read the info from the link you sent. Could you explain all that. I read it uses addresses 0 to 7 for its data and it uses different addresses for the SDA and SCL depending on the board. If I choose other inputs/outputs, I would think it would work, but it does not. 

@gameworn 

The library can only execute methods that are defined in the .h file and where code is provided to execute those methods.

You have tried to call a method which doesn't exist in the "Wire.h" library that you have specified to the compiler. I've never used an ESP32, so I can't help you determine if there is a different or alternate library for them.

On that page is an example "Master Writer/Slave receiver:Program two Arduino boards to communicate with one another in a Master Writer/Slave Receiver configuration via the I2C." which may be able to get you started with the Wire library.

If you click on the "begin()"under the function list, you'll see that the only method forms available for Wire.begin() take either an address or no argument at all. The compiler is just telling you that it can't find a method in the library that matches the form that you're using.

I have no idea where your source code came from, whether its yours or if you copied it from somewhere else. You may need to go back to the origin of the code to see if any different or special libraries are required.

I was kidnapped by mimes.
They did unspeakable things to me.


ReplyQuote
gameworn
(@gameworn)
Eminent Member
Joined: 2 years ago
Posts: 26
Topic starter  

Will

Thank You


ReplyQuote
fedimakni
(@fedimakni)
New Member
Joined: 3 days ago
Posts: 2
 

Any progress on this?

Could you please share the code if it's possible? I am working on the same application and i couldn't make it work.

Thanks


ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3050
 

@fedimakni It is best if you start a new topic. include properly formatted (Tools/Auto Format) code and a screen grab of the last error message plus a dozen or so lines prior.

It is considered poor judgement to traverse a chasm in 2 leaps.


ReplyQuote