Connect with us

I2C module for 2004 display

Discussion in 'Microcontrollers, Programming and IoT' started by bigone5500, Sep 14, 2015.

Scroll to continue with content
  1. Harald Kapp

    Harald Kapp Moderator Moderator

    12,326
    2,930
    Nov 17, 2011
  2. bigone5500

    bigone5500

    712
    121
    Apr 9, 2014
    I have not seen that FAQ but upon reading and attempting to decipher it, the last post looks like it says it is, but you have to be good at it or not buy it...???? Huh???
     
  3. bigone5500

    bigone5500

    712
    121
    Apr 9, 2014
    I soldered on a header and attached the display to the adapter. Loaded a sketch and modified it so it would show on all 4 lines.

    It works. I also replied to the post on the Banggood forum along with the image.

    20150915_163931.jpg
     
    Last edited: Sep 15, 2015
  4. Harald Kapp

    Harald Kapp Moderator Moderator

    12,326
    2,930
    Nov 17, 2011
    Good to hear. Does it truly address all 5 lines separately? Your picture could have been created even if only 2 lines are addressed correctly and the other two are mirrored. Try 4 different texts, just to be on the safe side.
     
  5. bigone5500

    bigone5500

    712
    121
    Apr 9, 2014
    True. I will do that later and post the results. I did take my clock sketch and just copy and paste the lines then change the row number.
     
  6. bigone5500

    bigone5500

    712
    121
    Apr 9, 2014
    I changed the sketch to verify that the display is not repeating itself. It is indeed working with a 1602 I2C interface. Disregard the temperature part of the sketch.

    Here is the code I used...don't laugh...o_O

    Code:
    #include <OneWire.h>
    #include <Wire.h>
    #include <DallasTemperature.h>
    #include <LiquidCrystal_I2C.h>
    #include <RealTimeClockDS1307.h>
    
    #define ONE_WIRE_BUS_1 2
    #define Display_Clock_Every_N_Seconds 10
    #define Display_ShortHelp_EveryN_Seconds 60
    
    String tz;
    int hours = 0;
    int minutes = 0;
    int seconds = 0;
    int ap = 0;
    
    
    OneWire oneWire_in(ONE_WIRE_BUS_1);
    
    DallasTemperature sensor_inhouse(&oneWire_in);
    LiquidCrystal_I2C lcd(0x27, 20, 4);
    
    float TFI;
    
    void setup(void)
    {
      lcd.begin();
    
      Serial.begin(9600);
      Serial.println("Dallas Temperature Control Library Demo - TwoPin_DS18B20");
    
      sensor_inhouse.begin();
    
      Serial.begin(9600);
    
      pinMode(A3, OUTPUT);
      digitalWrite(A3, HIGH);
      pinMode(A2, OUTPUT);
      digitalWrite(A2, LOW);
    }
    
    void loop(void)
    {
        RTC.readClock();
        if(ap == 1)
        {
        tz = "PM";
        }
        else
        {
        tz ="AM";
        }
        lcd.home();
        hours = RTC.getHours();
        minutes = RTC.getMinutes();
        seconds = RTC.getSeconds();
        ap = RTC.isPM();
       /*
        dates = RTC.getDate();
        months = RTC.getMonth();
        years = RTC.getYear();
       */
       lcd.setCursor(0, 0);
       lcd.print("Time1: ");
        lcd.print(hours);
        lcd.print(":");
        if (minutes<10) (lcd.print(0));
        lcd.print(minutes);
        lcd.print(":");
        if (seconds<10) (lcd.print(0));
        lcd.print(seconds);
        lcd.print(" ");
       // lcd.print(tz);
    
          lcd.setCursor(0, 1);
       lcd.print("Time2: ");
        lcd.print(hours);
        lcd.print(":");
        if (minutes<10) (lcd.print(0));
        lcd.print(minutes);
        lcd.print(":");
        if (seconds<10) (lcd.print(0));
        lcd.print(seconds);
        lcd.print(" ");
       // lcd.print(tz);
    
          lcd.setCursor(0, 2);
       lcd.print("Time3: ");
        lcd.print(hours);
        lcd.print(":");
        if (minutes<10) (lcd.print(0));
        lcd.print(minutes);
        lcd.print(":");
        if (seconds<10) (lcd.print(0));
        lcd.print(seconds);
        lcd.print(" ");
       // lcd.print(tz);
    
          lcd.setCursor(0, 3);
       lcd.print("Time4: ");
        lcd.print(hours);
        lcd.print(":");
        if (minutes<10) (lcd.print(0));
        lcd.print(minutes);
        lcd.print(":");
        if (seconds<10) (lcd.print(0));
        lcd.print(seconds);
        lcd.print(" ");
       // lcd.print(tz);
      
      Serial.print("Requesting temperatures...");
      sensor_inhouse.requestTemperatures();
      Serial.println(" done");
    
    
      delay(100);
    }
     
  7. Harald Kapp

    Harald Kapp Moderator Moderator

    12,326
    2,930
    Nov 17, 2011
    Very well, that FAQ was most misleading then.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-