Documentation on Wire slave sending

So i am trying to get a pi to i2c talk to an uno, the pi being the master. (This is not pi related, everything works fine there)

Since it took me the better part of a day to figure this out, and Arduino is such a great platform, i would like to give back by helping with the documentation problem that i uncovered.

Basically is wrong for the slave.
It should have something with OnRequest in the slave code.
Quite a good explanation i found in the forum I2C Send and Read Values - Programming Questions - Arduino Forum

I would be happy to make a pull request, as i think for other beginners this may be very helpful, and difficult as is.

Also i saw documentation on Wire.send , but the compiler complains that Wire.send does not exist.

If i can help, please let me know how.

Hi Torsten. Thanks for your interest in improving the Arduino documentation!

Basically is wrong for the slave.
It should have something with OnRequest in the slave code.

If you only want to propose changes to the code, my recommendation is to submit your pull request to the Arduino AVR boards repository:

This example sketch is essentially the same as the one in the tutorial. Once that is merged, the tutorial code can be updated to reflect it. That change should also be ported to the Wire libraries in Arduino's other hardware packages at that time.

Also i saw documentation on Wire.send , but the compiler complains that Wire.send does not exist.

I see, there are links from the "See Also" section of that tutorial to to Wire.send() and Wire.receive() reference pages, but the Wire library doesn't have either of these functions and they are not listed on the main Wire reference page. Perhaps these functions were part of a very old version of the Wire library and Arduino forgot to delete those pages and the links to them when they updated the library's API. In this case, it is not possible to submit a pull request, since the tutorial content is not stored in a repository. The best way to propose changes to the documentation is to submit an issue report to Arduino's bug tracker:

That will bring the problem to the attention of the people at Arduino with the ability to update the documentation content.

It used to be correct. I also noticed it a while ago.

When the reference was revamped, something must have gone wrong.

Which issue are you referring to @sterretje? The problem with the example sketch, or the links to the obsolete reference pages?

@rubydesign's description of the problem with the example sketch is vague and I haven't seen a pull request pop up yet for fixing it, so I'm interested in whether anyone else can confirmation that there is indeed a problem with that code. I haven't looked at the code closely or the linked thread yet.

Master Reader/Slave Sender

The example for the master reader code is correct, The example for the slave writer is not correct; it's the example for the slave reader.

As far as I know, this is the correct example for the slave writer (pulled from wiring): Wire::onRequest() \ Language (API) \ Wiring.

I think it went wrong when Arduino moved the code to create.

Ah, it makes sense now. Thanks for the clarification. I think your guess about this happening when they moved the tutorial code hosting to Arduino Create is right. They probably just grabbed the wrong share URL.

Here is the correct example sketch in the Wire library:

So I don't think this can be addressed by submitting a pull request. It should be done by opening an issue report here:

Sorry, no access to github at this moment; two factor autentication interfering.

I wasn't implying that I expected you to make the issue report on GitHub. The comments about GitHub were more directed to rubydesign, who had expressed an interest in working to get this fixed. Of course, anyone is welcome to follow through on this issue. It's on my "to-do" list, but that list is quite long.