i am working for a project based on lifi using arduino and i need to diplay content of sd card to lcd i tried a lot some online programs also i tried but there is a simple blank screen. one of the code i used is this:

#include <SD.h>
#include <SPI.h>

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7);

File myFile;
const int CSpin = 10;

void setup() {
  // put your setup code here, to run once:
  pinMode(CSpin, OUTPUT);

  lcd.setBacklightPin(3, POSITIVE);

void loop() {
  // put your main code here, to run repeatedly:

void ReadLine(){
  myFile = SD.open("Sample.txt", FILE_READ);
  char cr;
  for(unsigned int i = 0; i < (3 - 1);){
    cr = myFile.read();
    if(cr == '\n')

    cr = myFile.read();
    if(cr == '\n'){
    else if(cr >= 0x20 && cr <= 0x7E){

displays blank screen Please help me out!! Any other working program also would work.!! Thanks in advance.

  • 2
    How you managed to get just the display to work at all with one of the library examples without dealing with SD cards? – timemage Mar 28 at 16:09
  • sir i am really sorry i didnt get you!! . sir this code is copied from online i haven't coded sir could you please tell me what can i do to make it working!!! thanks sir in advance – Raj Mobilestore Mar 28 at 17:37
  • 1
    The LiquidCrystal_I2C library will have examples available under the File/Examples menu. With your SD card hardware disconnected, do any of these examples work? – timemage Mar 29 at 12:43
  • yes that example works perfectly sir!! – Raj Mobilestore Mar 31 at 5:04

Well The Do You Really Have an i2c module connected to the display you can find this out by checking how many pins the display has if it is not four pins then you need the LiquidCrystal Library If Not Then The Arguments Passed To The LiquidCrystal I2c Function Should Be The Address Witch Should Be 0x27 If You Did Not Modify The i2c Module(Next Time Give The Circuit Schmatics )

  • yes sir it has 4 pins and adress is also 0x27 !! – Raj Mobilestore Mar 31 at 5:06
  • sir could you provide the schematics pls?? because the above code is copied from google sir and this is a part of my project sir!! main is my lifi tech!! this is just to display content of sd card ! – Raj Mobilestore Mar 31 at 5:07
  • I see your problem it is addressed to 0x3F that is not your lcd address(After You Copy code edit it to fit your needs!) and the constructor is improper i have i2c LCD too and the constructor should have 3 arguments (Address,Lcd Coulums,Lcd Rows) Either Google Is Wrong Or They Made An mistake – Harsha Addanki May 20 at 21:18
  • You Don't Need To call me sir – Harsha Addanki May 20 at 21:25

You need schmatics here you Go :) : The Shchmatics BOI

  • (It might be better to edit your existing answer rather than post a separate answer :) – Dave Newton May 20 at 21:32
  • good point i should have done that – Harsha Addanki Jun 9 at 0:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.