B4R Question Wemos D1 mini with I2C LCD 16x2

Discussion in 'B4R Questions' started by Roger C, Apr 17, 2019.

  1. Roger C

    Roger C Active Member Licensed User

    Hi again,

    Trying to connect the D1 mini to an I2C display but nothing happens.
    Display is connected as this:
    SDA to pin D2
    SCL to pin D1

    Has anyone done this and can share information?

    I've tried this library but nothing on the screen.

    I've scanned the I2C adresses with this code and got 0e27 so the hardware works.
     
  2. positrom2

    positrom2 Active Member Licensed User

  3. derez

    derez Expert Licensed User

    Please show the relevant code. How do you init ? :
    Code:
    lcd.Initialize(0x3F162' for 16X2 lcd
    lcd.Initialize(0x27204' for 20X4 lcd
     
    Last edited: Apr 18, 2019
  4. Roger C

    Roger C Active Member Licensed User

    Thanks positrom2 and derez.

    A new day and a fresh start, suddenly things started to work.
    I changed to UNO and the display worked. Then back to D1... and it worked.

    Don't know what the problem was yesterday but thanks again.

    This is the C++ code that works and prints Hello World!
    Code:
    //YWROBOT
    //Compatible with the Arduino IDE 
    1.0
    //Library version:
    1.1
    #include <Wire.h>
    #include <LiquidCrystal_I2C.h>

    LiquidCrystal_I2C lcd(
    0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

    void setup()
    {
      lcd.init();                      // initialize the lcd
      lcd.init();
      // Print a message 
    to the LCD.
      lcd.backlight();
      delay(
    5000);
      lcd.setCursor(
    0,0);
      lcd.print(
    "Hello, world!");
    }


    void loop()
    {
    }
    This is the Basic code.

    Code:
    Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'Public variables can be accessed from all modules.
        Public Serial1 As Serial
        
    Private lcd As LiquidCrystal_I2C
      
    End Sub

    Private Sub AppStart
        Serial1.Initialize(
    115200)
        
    Log("AppStart")
        
        lcd.Initialize(
    0x27162'based on the example from the project.
        '   lcd.Initialize(0x27, 20, 4) ' for 20X4 lcd
        lcd.Backlight = True
        lcd.SetCursor(
    0,0)
        lcd.Write (
    "Row 1")
         lcd.SetCursor(
    0,1)
        lcd.Write(
    "99999999")  ' this shows
     
    End Sub
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice