Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By mrburnette
#58316 I used one of those $1 Chinese 1602 parallel to I2C adapters and the code below to test with the ESP8266 ... worked OK.

Code: Select all/*
    Arduino 1.6.7 on Linux Mint 17.3 tested 20160204
    ESP8266-Arduino Core: http://arduino.esp8266.com/staging/package_esp8266com_index.json
      Sketch uses 233,292 bytes (53%) of program storage space. Maximum is 434,160 bytes.
      Global variables use 31,525 bytes (38%) of dynamic memory, leaving 50,395 bytes for local variables. Maximum is 81,920 bytes.
    Get the LCD I2C Library here (LiquidCrystal 1.2.1:  https://bitbucket.org/fmalpartida/new-liquidcryst...
    Download the ZIP, copy the LiquidCrystal folder to ~/Arduino/libraries/LiquidCrystal_I2C
*/


#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the pins on the I2C chip used for LCD connections:
//                   addr,   en,  rw,  rs,  d4,  d5,  d6,  d7,  bl,   blpol
LiquidCrystal_I2C lcd(0x27,   2,   1,   0,   4,   5,   6,   7,   3,   POSITIVE);


void setup()
{
  Serial.begin(9600); // Used to type in characters
  lcd.begin(16, 2); // initialize the lcd for 16 chars 2 lines and turn on backlight
  // ------- Quick 3 blinks of backlight -------------
  for (int i = 0; i < 3; i++)
  {
    lcd.backlight();
    delay(250);
    lcd.noBacklight();
    delay(250);
  }
  lcd.backlight(); // finish with backlight on
  //-------- Write characters on the display ----------------
  // NOTE: Cursor Position: CHAR, LINE) start at 0
  lcd.setCursor(2, 0); //Start at character 4 on line 0
  lcd.print("hello rayburne");
  delay(1000);
  lcd.setCursor(2, 1);
  lcd.print("SofKinetics");
  delay(1000);
  lcd.setCursor(0, 2);
  lcd.print("16x2 Line Display");
  lcd.setCursor(0, 2);
  delay(2000);
  lcd.print("http:hackster.io");
  delay(8000);
  // Wait and then tell user they can start the Serial Monitor and type in characters to
  // Display. (Set Serial Monitor option to "No Line Ending")
  lcd.setCursor(0, 0); //Start at character 0 on line 0
  lcd.print("Start Serial Monitor");
  lcd.setCursor(0, 1);
  lcd.print("Type chars 2 display");
}


void loop()
{
  if (Serial.available()) {
    // wait a bit for the entire message to arrive
    delay(100);
    // clear the screen
    lcd.clear();
    // read all the available characters
    while (Serial.available() > 0) {
      // display each character to the LCD
      lcd.write(Serial.read());
    }
  }
}

/*
    Source: http://www.instructables.com/id/I2C-LCD-Controller-the-easy-way/?ALLSTEPS
    Exact I2C adapter: http://www.aliexpress.com/item/IIC-I2C-Interface-LCD1602-2004-LCD-Adapter-Plate-for-Arduino-FZ0519-Free-Shipping-Dropshipping/1798929219.html
    LiquidCrystal library: https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
General Notes:
The specific LCD I2C adapter must be specified:
// Set the pins on the I2C chip used for LCD connections:
//                   addr,   en,  rw,  rs,  d4,  d5,  d6,  d7,  bl,   blpol
LiquidCrystal_I2C lcd(0x27,   2,   1,   0,   4,   5,   6,   7,   3,   POSITIVE);

No other LiquidCrystal_I2C library can be in the user /Arduino/libraries directory.
 */