Firmata I2C read and write

Hello,

I connected 2 arduino micro's using the I2C connector and now I want to exchange data via firmata and Johnny Five.

1 Arduino micro has the firmata firmware
1 Arduino micro should have custom firmware
Application is running Johnny Five

I'm looking for the minimum amount of code required to read and write data over I2C. Can someone provide a basic sketch? I succeded to write data, but I'm unable to read data. I like to retrieve the data in my Johnny Five application.

Also, is it possible to request specific data?

I hope someone can help,
Roy

Look at the examples that come with the Wire library, Master_sender, slave_reader, etc. They will give you a good idea of what you need to do.

As for requesting specific data, most i2c devices have an internal memory map (such as a real time clock) so when you read a certain address, you get a certain value (e.g. hour, minute, seconds, year, etc.)

You could implement something like that in your arduino. You read address 0 and you get sensor1 value, you read address 1, you get sensor2 value, etc.