Notifications
Clear all

I2C using two ESP32 Modules Master works, Slave has errors

8 Posts
4 Users
0 Likes
2,618 Views
(@gameworn)
Member
Joined: 4 years ago
Posts: 30
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
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2527
 

@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.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@gameworn)
Member
Joined: 4 years ago
Posts: 30
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)
Member
Joined: 3 years ago
Posts: 2527
 
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.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@gameworn)
Member
Joined: 4 years ago
Posts: 30
Topic starter  

Will

Thank You


   
ReplyQuote
(@fedimakni)
Member
Joined: 2 years 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)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6958
 

@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.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@gameworn)
Member
Joined: 4 years ago
Posts: 30
Topic starter  

@fedimakni

Are you still interested in receiving my files? I got it to work, mostly. I am building an underwater ROV connected with a cat5 cable to a laptop on a boat. 

  I use a program called Game Control Plus. It interfaces a wireless XBox controller very nicely  to  a program called "Processing". Processing  uses the same coding as the Arduino IDE(mostly), but it has a huge graphics interface, so you can make neat drawings and animate them.

 I output this using the RJ45 cat5 port to an Arduino Mega with an ethernet shield . I used IP/TCP protocol(not sure of the wording here) to communicate between the laptop and Mega board.

 I used Processing to put a bunch of switches on my computer screen to turn motors off/on, turn the lights on/off. monitor the battery voltage, and monitor the direction from the XBox controller. It is a massive file as I have used 6 red, green, yellow lights to represent switch positions, a voltmeter, and switches to turn things on/off. It makes the program look huge, but a lot of it just repeats itself.

 There are 2 files. one for all the Processing controls, and one for the Arduino mega. I choose the Mega because I needed more I/O than the Uno could provide. The ethernet switch uses a bunch of the Uno's I/O, so it leaves the it a bit short.


   
ReplyQuote