I'm currently working on a project which requires communication between 3 Arduino I'm using I2C bus as one master and two slaves. First one is the 9 axis orientation shield connected to the Arduino Uno and second is a Arduino mega that gives sensor values of LSA 08 . I have assigned role of master to the third Arduino mega . I have tested individually both works fine . But when I combine the code of both to work together i couldn't get the both data correctly. Sometimes only LSA data is received or something nothing is get received.
Please help me with this
ChatGPT
Hello everyone,
I'm working on a project that involves communication between three Arduinos using the I2C bus: one Arduino Uno as the master with a 9-axis orientation shield, and another Arduino Mega that provides sensor values from an LSA 08 sensor. The third Arduino Mega acts as the master coordinating these communications.
Individually, each setup works fine, but when I combine the codes for both Arduinos, I'm facing issues. Sometimes I only receive data from the LSA sensor, and other times I receive no data at all.
I'd appreciate any help or suggestions to resolve this issue.
Why? Why not run all sensors/peripherals on a single controller board? It's usually easier that way.
Technically possible, but you'd have to write an interfacing routine that makes the Mega do the following:
1: Interface with the LSA08 sensor
2: Relay commands and data from/to the LSA08 over I2C
This can be done, but it's a roundabout way and as said above, it's a lot more straightforward to just use one suitable controller board.
Post a schematic of your actual system, a photograph of how you have everything connected and the actual code used on these Arduino boards. It's also not clear what you mean by "combine the codes" - most people who use this phrase refer to merging two (or more) sketches into a single sketch to be run on a single board. You mentioned 3 Arduinos, one being an Uno and one being a Mega.
If they work individually but not in combination, it might be your codes. Please post them (please don't forget to use code tags as described in How to get the best out of this forum.
@rsmls, the third one also seems to be a Mega based on the opening post.