Hiiii
I have 4 analog sensors. I have read the analog output of all sensors using Arduino Uno. now I want to write all sensor data using I2C protocol into another microcontroller that also has I2C.
This means I read analog sensor output and write this data into Pixhawk I2C port.
Can anyone guide me on how can I write sensor data into Pixhawk I2C port?
The I2C bus has a Master. The Master can send data to Slaves and the Master can request data from Slaves.
Normally the Arduino is the Master and sensors are the Slaves.
Suppose that the Pixhawk I2C port is the Master, then the Pixhawk should request data from the Arduino.
If this Pixhawk acts as I2C slave, simply have the Arduino write the data to it. All you need to know is the I2C address of the Pixhawk, and the format in which it expects the data.
If the Pixhawk acts as I2C master, you have to program the Arduino to act as I2C slave instead, and wait for the Pixhawk to request the data. Now you have to set the Pixhawk to request from the I2C address you set the Arduino to, and have the Arduino respond with the data in the expected format.