fmalpartida / New-LiquidCrystal

Clone of the new liquid crystal library from: https://bitbucket.org/fmalpartida/new-liquidcrystal
Other
106 stars 90 forks source link

can I use 3 displays as an array #7

Closed muuc closed 3 years ago

muuc commented 3 years ago

I am using your library, thanks for creating.

until now:

include

include

include

LiquidCrystal_I2C lcd5(0x25, 2,1,0,4,5,6,7,3,POSITIVE); LiquidCrystal_I2C lcd6(0x26, 2,1,0,4,5,6,7,3,POSITIVE); LiquidCrystal_I2C lcd7(0x27, 2,1,0,4,5,6,7,3,POSITIVE); ... lcd5.begin(16,2); lcd6.begin(16,2); lcd7.begin(16,2); ...

Is it possible to create an array of lcds to use sth like for (byte i=0; i<3; i++) lcd[i].begin(16,2);

Thanks in advance!

fmalpartida commented 3 years ago

Hi,

Thanks for using the library.

Yes, it should be possible. They would be independent instances that you can the us.

Best, fm

iPhone courtesy typos

On Feb 24, 2021, at 01:54, muuc notifications@github.com wrote:

 I am using your library, thanks for creating.

until now:

include

include

include

LiquidCrystal_I2C lcd5(0x25, 2,1,0,4,5,6,7,3,POSITIVE); LiquidCrystal_I2C lcd6(0x26, 2,1,0,4,5,6,7,3,POSITIVE); LiquidCrystal_I2C lcd7(0x27, 2,1,0,4,5,6,7,3,POSITIVE); ... lcd5.begin(16,2); lcd6.begin(16,2); lcd7.begin(16,2); ...

Is it possible to create an array of lcds to use sth like for (byte i=0; i<3; i++) lcd[i].begin(16,2);

Thanks in advance!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

muuc commented 3 years ago

Hi,

thanks for your quick response.

after many trials and errors ...

I succeeded with

LiquidCrystal_I2C lcd_5(0x25, 2,1,0,4,5,6,7,3,POSITIVE); LiquidCrystal_I2C lcd_6(0x26, 2,1,0,4,5,6,7,3,POSITIVE); LiquidCrystal_I2C lcd_7(0x27, 2,1,0,4,5,6,7,3,POSITIVE);

LiquidCrystal_I2C lcd[3]= {lcd_5, lcd_6, lcd_7}; ... for (byte i=0; i<3; i++)  lcd[i].begin(16,2); ...

Is this the only way?

kind regards H.Demmer

Am 24.02.2021 um 16:14 schrieb fmalpartida:

Hi,

Thanks for using the library.

Yes, it should be possible. They would be independent instances that you can the us.

Best, fm

iPhone courtesy typos

On Feb 24, 2021, at 01:54, muuc notifications@github.com wrote:

 I am using your library, thanks for creating.

until now:

include

include

include

LiquidCrystal_I2C lcd5(0x25, 2,1,0,4,5,6,7,3,POSITIVE); LiquidCrystal_I2C lcd6(0x26, 2,1,0,4,5,6,7,3,POSITIVE); LiquidCrystal_I2C lcd7(0x27, 2,1,0,4,5,6,7,3,POSITIVE); ... lcd5.begin(16,2); lcd6.begin(16,2); lcd7.begin(16,2); ...

Is it possible to create an array of lcds to use sth like for (byte i=0; i<3; i++) lcd[i].begin(16,2);

Thanks in advance!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fmalpartida/New-LiquidCrystal/issues/7#issuecomment-785145505, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDDVN5HG76P4ONG2XN3M33TAUJUNANCNFSM4YEGA53Q.

fmalpartida commented 3 years ago

Very much it should be. The way the library was written was to enable users to create multiple instances of the LCD. However, things are not written to multiple LCDs as if it was only one LCD. You have to manage what you present on each individual LCD. In the example above, address lcd_5, lcd_6, lcd_7 with the corresponding methods.