[solved] lcd i2c backlight

hi i am trying to make a project that can measure the resistance cables which will pass or fail them, but i cant get the backlight of the lcd i2c to turn on, i have attatched the programming and a picture at the bottom.

#include <LiquidCrystal_I2C.h>
#include <Adafruit_Thermal.h>
Adafruit_Thermal printer(&Serial1);      // Or Serial2, Serial3, etc.
LiquidCrystal_I2C lcd(0x3F,16,2);
int pointsevenfivemtr = 2;
int twomtr = 3;
int threemtr = 4;
int fourmtr = 5;
int fivemtr = 6;
int sixmtr = 7;
float Vin = 3.3;
float R1 = 10;
int relayswitchPin = 13;

float voltage =0;


void setup() {
  // put your main code here, to run repeatedly
Serial1.begin(19200);
analogReadResolution(12);
printer.begin();
pinMode(relayswitchPin,OUTPUT);
pinMode(pointsevenfivemtr, INPUT);   
pinMode(twomtr, INPUT);
pinMode(threemtr, INPUT);
pinMode(fourmtr, INPUT);
pinMode(fivemtr, INPUT);
pinMode(sixmtr, INPUT);
lcd.setCursor(0,0);
lcd.print("ENTER SELECTION:");
lcd.backlight();


}

void loop() {

digitalWrite(pointsevenfivemtr, HIGH);
  digitalWrite(twomtr, HIGH);
  digitalWrite(threemtr, HIGH);
  digitalWrite(fourmtr, HIGH);
  digitalWrite(fivemtr, HIGH);
  digitalWrite(sixmtr, HIGH);
  
  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////0.75M
if (digitalRead(pointsevenfivemtr) == LOW )
  {
    
    lcd.setCursor(0,1);
    lcd.print("0.75 METER...");
    delay(3000);
    
  
//----------------NEGATIVE/NEGATIVE TEST--------------------//


       digitalWrite(relayswitchPin, LOW);   
       delay(5000);    
       

      
      int sensorValue = analogRead(A5);
    
       delay(1);
     
      voltage = (sensorValue * (Vin / 4095)) ;
      
      float negnegR2= (((R1*Vin)-(R1*voltage))/voltage)-10-0.4;
      delay(1);

      lcd.clear();
      lcd.setCursor(0,0);
      lcd.leftToRight();
      lcd.print("--R: ");
      lcd.print(negnegR2,1);
     
                 
//----------------POSITIVE/POSITIVE TEST--------------------//


    
      digitalWrite(relayswitchPin, HIGH);
      delay(5000);
   
      sensorValue = analogRead(A3);
    
      delay(1);
    
        
      voltage = (sensorValue * (Vin / 4095));
      
      float posposR2= (((R1*Vin)-(R1*voltage))/voltage)-10-0.4;
    
      lcd.setCursor(0,1);
      lcd.leftToRight();
      lcd.print("++R: ");
      lcd.print(posposR2,1);
      delay(5000);
if (posposR2>negnegR2 && posposR2>1.2 && posposR2<1.8 && negnegR2>0.7 && negnegR2<1.3){

  lcd.clear();
  lcd.setCursor(4,0);
  lcd.print("0.75 mtr");
  lcd.setCursor(2,1);
  lcd.print("TEST PASSED!");
     printer.setSize('M');
   printer.println("0.75M PASS");
    printer.setSize('M');
   printer.print("--R:");
   printer.println(negnegR2);
   printer.print("++R:");
   printer.println(posposR2);
   printer.println();
   printer.println();
   printer.println();
   printer.println();
   lcd.clear();
   lcd.setCursor(0,0);
   lcd.print("ENTER SELECTION:");
   digitalWrite(pointsevenfivemtr, HIGH);
  digitalWrite(twomtr, HIGH);
  digitalWrite(threemtr, HIGH);
  digitalWrite(fourmtr, HIGH);
  digitalWrite(fivemtr, HIGH);
  digitalWrite(sixmtr, HIGH);
  }else{
  lcd.clear();
  lcd.setCursor(2,0);
  lcd.print("TEST FAILED!");
  delay(6000);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("ENTER SELECTION:");
  digitalWrite(pointsevenfivemtr, HIGH);
  digitalWrite(twomtr, HIGH);
  digitalWrite(threemtr, HIGH);
  digitalWrite(fourmtr, HIGH);
  digitalWrite(fivemtr, HIGH);
  digitalWrite(sixmtr, HIGH);
  }
  
  }
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

}

Maybe this works:

lcd.setBacklight(HIGH);

You have a jumper on the two pin connector on the I2C backpack (it's just not visible in your first picture) ?

The OP's sketch contains the lcd.backlight() command; but, he is missing the lcd.init(); command. In addition, the jumper (as Post#1 has said) should be ON on the I2C backpack small board.

6v6gt:
Maybe this works:

lcd.setBacklight(HIGH);

Actually, the parameter for setBacklight(dimvalue) is supposed to be a dimvalue not HIGH or LOW or 0/1 or 0/non-zero.

The LiquidCrystal_I2C code does treat any non zero dimvalue as on since the backpack h/w can't do dimming but still using HIGH for a parameter is not correct.
Using the dimvalue of HIGH (which is typically a value of 1) would create a very dim backlight if the code were used with a different library and h/w that supported dimming like an LCD keypad shield.

--- bill

ahh thanks for your help yeah it was the fact that i was missing a jumper

bperrybap:
Actually, the parameter for setBacklight(dimvalue) is supposed to be a dimvalue not HIGH or LOW or 0/1 or 0/non-zero.

The LiquidCrystal_I2C code does treat any non zero dimvalue as on since the backpack h/w can't do dimming but still using HIGH for a parameter is not correct.
Using the dimvalue of HIGH (which is typically a value of 1) would create a very dim backlight if the code were used with a different library and h/w that supported dimming like an LCD keypad shield.

--- bill

OK. Thanks for that. I wasn't aware that there were some vestiges of backlight intensity control in the design of the library.
Although I find the I2C backpacks very convenient, attempting to dim the leds using the available connectors (ie not hacking the board) is not nice. It appears the only option is to remove the 2 pin jumper and drive the led's anode via the "LED" pin using PWM and a suitable transistor. Since this is high side, it adds to the difficulty if you are using a 3.3v arduino.

schematic

6v6gt:
OK. Thanks for that. I wasn't aware that there were some vestiges of backlight intensity control in the design of the library.

The setBacklight(dimvalue) API semantics is based on the LCD API 1.0
https://playground.arduino.cc/Code/LCDAPI

The hd44780 library i/o classes honor this as well as the LiquidCrystal API
which includes backlight() noBacklight() across all h/w interfaces.
This allows the main line sketch code to be exactly the same regardless of the h/w interface used to communicate with the LCD.
When using the hd44780 library, the only thing that changes between h/w interfaces is the constructor.

--- bill