Sending Ultrasonic sensor data from slave to master using I2C

Hi guys,

I am kinda new to the Arduino world. I wanted to know how can I send a Ultrasonic sensor data from a slave(Arduino UNO) to a Master(Arduino MEGA) using the I2C protocol. It would be great if someone shed some light in this. And also helped me out with the code. I know how to use an ultrasonic sensor, and also how to do some basic C++ coding.

You must have heard about this worldwide oracle called "Google". I'm sure if you ask it nicely, it will give you more tutorials, sample code and other information than you possibly need.

Now for the real question: why don't you just connect this ultrasound sensor to your Mega? It's hard to imagine you're running out of pins already, and I2C can't handle long wires as well as the ultrasound sensor itself.

About that, you see for my project I am already using 2 Ultrasonic sensors, a GPS, and a Compass. I need 3 sensors that is why I thought of using the slave. And if you didn't know the other 4 are serial interfaces and they take up the 4 UARTS on the MEGA. So that is the reason why I want to use a slave.
And about Google, I did not really find what I was looking for, like how to transmit data, and the other stuff.

List the sensors with their interfaces (provide links).
I find it hard to believe that a Mega with 54 pins can't do what you want.

Indeed, I had the same idea. Especially as I don't know any ultrasound sensors that use serial for communication (that accounts for most sensors) so even with all serial interfaces occupied that shouldn't be an issue.

wvamrle, thanks a lot for your guidance I will try to connect all of the sensors and post the final result in a week or so. Have some school work to get done :frowning: