Why display is not working when i select PCF8574?but working when MCP 23008 is selected?

I am trying to run(built-in/ready made )lcd template that is available on tinkercad website. When i click on LCD there are two options in type box 1) (which is default) MCP 23008-based 2) PCF 8574-based

When i select option 1 and then press start simulation ,my code is running fine and lcd is displaying properly but when i select option 2 and then press start simulation,nothing is displayed but also no error is shown on serial monitor.

My modified code is as follow:

// C++ code
//
//#include <Adafruit_LiquidCrystal.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

int seconds = 0;

//#Adafruit_LiquidCrystal lcd_1(0);
LiquidCrystal_I2C lcd_1(0x27, 16, 2);
void setup()
{
  lcd_1.begin(16, 2);

  lcd_1.print("Hello World");
  
}

void loop()
{
  lcd_1.setCursor(0, 1);
  lcd_1.print(seconds);
  lcd_1.setBacklight(1);
  delay(500); // Wait for 500 millisecond(s)
  lcd_1.setBacklight(0);
  delay(500); // Wait for 500 millisecond(s)
  seconds += 1;
}

while original code was

// C++ code
//
#include <Adafruit_LiquidCrystal.h>

int seconds = 0;

Adafruit_LiquidCrystal lcd_1(0);

void setup()
{
  lcd_1.begin(16, 2);

  lcd_1.print("hello world");
}

void loop()
{
  lcd_1.setCursor(0, 1);
  lcd_1.print(seconds);
  lcd_1.setBacklight(1);
  delay(500); // Wait for 500 millisecond(s)
  lcd_1.setBacklight(0);
  delay(500); // Wait for 500 millisecond(s)
  seconds += 1;
}

When i used lcd_1.init() instead of lcd_1.begin() my problem has been solved and now LCD is working fine and giving proper display. But i am unable to understand why lcd_1.begin() is not working properly even when i passed the arguments of screen size 16x2lcd_1.begin(16,2)

I saw usage of lcd_1.init() in below link

Different libraries might use different member functions, some use init, some use begin.
The Arduino LCD API 1.0 knows init(), but in the end you must use what your library needs.

Always use the member functions like described in the EXAMPLES OF THE LIBRARY you are using.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.