I2c LCD not displaying

Success, the cursor position is line,column and on a 16x2 the lines are 1 and 2:

void setup()
{

  delay(800);

  Wire.begin();
  //pinMode(ledPin, OUTPUT);      // sets the digital pin as output

  lcd.setType(LcdAddr,2,16);      // Define rows and columns for LCD
  lcd.clear(LcdAddr);
  lcd.backLight(LcdAddr,60);

  lcd.setCursor(LcdAddr,1,3);
  lcd.print(LcdAddr," HobbyTronics");    // Print a message to the LCD.
  
  lcd.setCursor(LcdAddr,2,1);
  lcd.print(LcdAddr,"Line 2 ?");
}

Many thanks everyone. I've learned a lot there.

I will have a bit of a play with this lcd and i2c module but I think I will find a more standard one for the project I'm trying to build.

@scubascooby

Glad the display is working. At least the backpack is not going to waste.

You can easy build your own "backpack" by just using a PCF8574. The PCF8574 need pullup resistors at the output of the chip. I build my own and I have a test code. I just simply follow the datasheet of the LCD display and the datasheet of the PCF8574.

Here my code

#include <Wire.h>

byte device_address = 0x20; // I connect the A0, A1, A2 to GND I2C address of the PCF8574
byte data_out;

byte RS_pin = 2;
byte E_pin = 3;

const unsigned int enable_signal = 1500; // E pin pulse for 1.5 millisecond duration

char message[11]="HELLO WORLD";

void setup() 
{
  pinMode(RS_pin, OUTPUT);
  pinMode(E_pin, OUTPUT);
  digitalWrite(RS_pin, LOW);
  digitalWrite(E_pin, LOW);
  Wire.begin();
  data_out = B00111000; // Set the display for 8 bits mode, 2 line
 Wire.beginTransmission(device_address);
  Wire.write(data_out);
  Wire.endTransmission();
  digitalWrite(E_pin, HIGH);
  delayMicroseconds(enable_signal);
  digitalWrite(E_pin, LOW);
  data_out = B00001111; // cursor setting
  Wire.beginTransmission(device_address);
  Wire.write(data_out);
  Wire.endTransmission();
  digitalWrite(E_pin, HIGH);
  delayMicroseconds(enable_signal);
  digitalWrite(E_pin, LOW);
 }

void loop()
{
  data_out = B00000001; // clear the display
  digitalWrite(RS_pin, LOW);
  Wire.beginTransmission(device_address);
  Wire.write(data_out);
  Wire.endTransmission();
  digitalWrite(E_pin, HIGH);
  delayMicroseconds(enable_signal);
  digitalWrite(E_pin, LOW);
  data_out = B10000000; // set the display data address location
  digitalWrite(RS_pin, LOW);
  Wire.beginTransmission(device_address);
  Wire.write(data_out);
  Wire.endTransmission();
  digitalWrite(E_pin, HIGH);
  delayMicroseconds(enable_signal);
  digitalWrite(E_pin, LOW);

  digitalWrite(RS_pin, HIGH);
  for (int x=0;x<11;x++)
  {
     Wire.beginTransmission(device_address);
     Wire.write(message[x]);
     Wire.endTransmission();
     digitalWrite(E_pin, HIGH);
     delayMicroseconds(enable_signal);
     digitalWrite(E_pin, LOW);
     delay(200);
  }
  delay(3000);
}

The trick is .... you first setup the RS pin of the LCD ( register select) 0 for command 1 for data to be display. Second, you send the data ( command or data to be display ) and you set the E pin for a few millisecond ( create a pulse ). Repeat the procedure for sending a command / display data.

I'm trying to avoid as much low level electronics as possible. I want Lego not Papier mache :slight_smile:

I want to build a functional, robust, diver-proof trimix analyser so there will be a lot of work in the structural parts to keep me busy.