so im doing a project involving a couple of distance sensors and i2c with 2 Arduino nano 3.0s. I have multiple sensors and what im trying to accomplish is, whenever a sensors detects a threat it sends data to the other Arduino and then it can distinguish which sensor received the threat. I was thinking of sending a particular number over from a slave device and the master receiving it, is this possible and if so how can it be done?
Over what distance? I2C was not designed for long wires.
oh its not a very long wire, they are short. I was wondering how I could send over a specific number and receive that number over the other side without it being changed?
hell0world:
oh its not a very long wire, they are short. I was wondering how I could send over a specific number and receive that number over the other side without it being changed?
If that were the case, I2C wouldn't be very useful, would it? Yes, you can, with the Wire library.
how would that be done without changing the value on the other side? It seems like the wire library cant send a exact value and keep it the same on the other side, the arduino tutorials dont seem to answer my question?
hell0world:
how would that be done without changing the value on the other side? It seems like the wire library cant send a exact value and keep it the same on the other side, the arduino tutorials dont seem to answer my question?
I can see why. Your question makes no sense. Try to narrow it down with an example.
okay sorry about that. Lets say you have 3 distance sensors and whenever a threat is in its range, lets say 29 cm or less it transmits to the other arduino board a specific number corresponding to that particular sensor , each sensor corresponds to a different number. How can you send integer numbers over i2c and receive them on the receiver/Master without changing the value of the number that was sent? Does that make any more sense?