How to understand compatibility or libraries?

I am trying to using many libraries, and considering using more, and recently learrned that some of them might not work together, especially ones which using same ports, timers etc...

So, how can I learn if any two of them are compatible or not? Can I understand it by checking their source code or datasheet? I could not understand much from NewPing source code to be fair..

Can we just say any library which is based on same hardware are not compatible? Then we could just understand from the description? Some functions have explanations wiith them(like Wire or attachInterrupt function), but some functions or libraries needs further inspection to find out.(SoftwareSerial problems..)

So basically, is there a general approach or technique which helps?

Thanks...

Can I understand it by checking their source code

Yes. The documentation should have a list of what hardware resources it uses but this is seldom done.

Can we just say any library which is based on same hardware are not compatible?

No. Their are many libraries based on the Arduino that are compatible. Things that drive devices on the I2C bus will in general work together, as will many SPI based libraries.

So basically, is there a general approach or technique which helps?

No.

vatantursu: recently learrned that some of them might not work together,

There are two problems underlying this ...

First, many authors write their library just to solve one problem and don't consider that they may be using resources that might be needed for something else working alongside it.

Second, the Arduino does not have many resources so it can be difficult to avoid a clash even if you want to.

And all of that is compounded by poor or non-existent documentation. Unfortunately Open Source programmers are generally not interested in sitting down and writing good documentation.

...R

Grumpy_Mike: Yes. The documentation should have a list of what hardware resources it uses but this is seldom done. No. Their are many libraries based on the Arduino that are compatible. Things that drive devices on the I2C bus will in general work together, as will many SPI based libraries. No.

Robin2: There are two problems underlying this ...

First, many authors write their library just to solve one problem and don't consider that they may be using resources that might be needed for something else working alongside it.

Second, the Arduino does not have many resources so it can be difficult to avoid a clash even if you want to.

And all of that is compounded by poor or non-existent documentation. Unfortunately Open Source programmers are generally not interested in sitting down and writing good documentation.

...R

So, all I can do is searching through user feedbacks if my code does not as I hope? It will be a problem for me.

Thanks for help.

vatantursu:
So, all I can do is searching through user feedbacks if my code does not as I hope? It will be a problem for me.

I don’t think things are quite as bleak as that.

You should always build your project in stages, testing as you go, so that way you can detect an incompatibility very early. And then you will have a lot of knowledge and information from which to find a solution.

…R