Confusion regarding LiquidCrystal_I2C library?

LiquidCrystal_I2C

please check the above link. It is github link of LiquidCrystal_I2C library. I have also attached a snap of it and highlighted code line 24 which is `#include "Wire.h'

Does that means wire library is already included in LiquidCrystal_I2C library?

So if we are writing code for any scenario where wire library is required( forexample using LCD with arduino through i2c scanner.) In that scenario, at top of our sketch, its enough to include just LiquidCrystal_I2C or wire library should also be included additionally?

That LiquidCrystal Library includes Wire.h

If I2C is needed in the sketch for other I2C devices I would include Wire.h at the top of the user sketch. There is no big risk for "double" include as the Wire.h should have an include guard anyway.

@ noiasca
you wrote'If I2C is needed in the sketch for other I2C devices I would include Wire.h at the top of the user sketch. '

please explain that? Is that necessary when using additional I2C devices?and what about the case when only one I2C device(LCD) is used??

That's just my common practice.
If I know that one of my devices needs Wire.h - I include Wire.h

Sorry i couldn't clarify my point

Please let me know, is it necessary to additionally include wire.h besides LiquidCrystal_I2C.h?

If we only include LiquidCrystal_I2C.h, will we get error?

no.

In the case of LiquidCrystal_I2C there are multiple libraries with that name. A particular library may include Wire.h, it may not. The way to know for sure is to examine the source code for the library in question.

@groundFungus
I am talking about the library whose github link is shared above

How can i examine the source code for this library?

check the files of the library.

@abtj_90
You have already created the third or fourth topic about LiquidCrystal_I2C and Wire. Cross-posting is a violation of forum rules. Please discuss related issues in one topic.

And is this question really so complicated that you need to ask three times? :slight_smile:

With the specified library, you don't need to include the Wire.h additionally, because it is already included in the library file. However, if you're not sure, you can include the Wire.h explicitly - it won't be a mistake. For example, if your program uses other devices on the i2c bus, you can include the Wire.h at the beginning of the sketch before other libraries, even if some libraries already include it

I thought wire.h was included in arduino.h as twi.h (once was twowire.h)