My problem is most likely down to the fact that I don't know the programming environment too good, I think.
I'm trying to connect Arduino 101 with Mega 2560 using I2C - so the Wire library.
After some research it looks like the 101 (Intel Curie) doesn't have a concept of I2C slave whatsoever. It can only become master - no problem, I was going to use it in this scenario anyway.
My problem lies within the Wire library though. My Arduino environment installation (this particular one) was mostly used to program the 101 and somehow from now on it only recognizes the Wire library for Intel Curie processor, which lacks the routines needed for Mega to become the slave on I2C.
When connecting the Mega, the compiler still tries to use the Intel Curie Wire library so I'm getting, at least, errors on usage of Wire.onReceive and Wire.onRequest.
Is there a way to explicitly tell the compiler which library to use (the other library, the correct one, is still there, in the right place, it is just not being taken into account).
Or perhaps there is some other way to distinguish between them? The copying of the correct library files to the folder with a project would probably work but it seems to be unnecessarily messy. Also I'd really like to avoid two different environments for programming the PCB-s.
If the library was provided by Arduino, the wire library should change to match the board when you select the board as a Mega2560. I use the standard wire library with a Mega as an I2C slave.
pert: with all due respect but I won't be posting the error messages. It will be pointless. I keep the verbose output during compilation on for at least a year now on my sketches as I do like to know what happens under the hood. I understand the errors I'm getting. I've been through both Wire libraries and can see how they differ. I just though there might be some clever stuff in the environment which I might broke in some silly way, you guys might know how to fix.
SurferTim: I suspected it should work like that. I've seen it working like that on other stuff. I sometimes move sketches and boards between my work and home computers (Windows) and laptop (Mac) and all usually works. Only recently (a few months now) it stopped on my home computer (unfortunately the main one).
I think Arduino on my home computer is long overdue for a cleanup. I'll try to do a clean installation with only these libraries I normally use. And before installing them all I will try do some experiments with the Wire lib. and both processors. We shall see... Then if still in dung, I'll post something more.
The 101 has a built in gyro. I have an external gyro, and it uses I2C for comm. I'm not sure how well setting up an I2C slave will coexist with the gyro.
Yeah, I know. I tried the built-in gyro some time ago. Not the most sensitive one, it might struggle with balancing a fast drone, but perfectly enough to detect a walk or balancing a single wheel.
With 101 the Intel Curie processor is not exposing a slave mode on I2C to the external world at all. I can't find the thread I read about that but found this: