I am trying to get a 16x1 display working, in fact I have 2 to choose from but they both have the same problem.
According to this web site there are 2 types of 16x1, the second type shows the first 8 characters as dark when nothing is entered in the unit and the second 8 as light as mine both do.
I have taken a section from a longer program that works on its own (please don't bother commenting on the unused lines I was going to add them in to test further after getting this bit to work).
#include <IRremote.h>//remove the robot libraries and include kens from here https://github.com/shirriff/Arduino-IRremote
#include <Wire.h>
#include <LiquidCrystal_I2C.h> // F Malpartida's NewLiquidCrystal library
#include "LedControl.h"//turns 8 digits off see lc.control below & next line
//LedControl lc=LedControl(7,8,6,1);//data,clock,latch,number of ics, see previous line
//LedControl lcmatrix=LedControl(2,4,3,2);
#define I2C_ADDR 0x27 // Define I2C Address for controller
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
//SDA A4.
//SCL A5.
#define LED_OFF 0
#define LED_ON 1
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin,BACKLIGHT_PIN,POSITIVE);
//either use the line above and the defines or use
// LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3,POSITIVE);
int RECV_PIN = 5;
IRrecv irrecv(RECV_PIN);
decode_results results;
int i=0;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
lcd.begin (16,1); // initialize the lcd
// Switch off the backlight
// lcd.setBacklightPin(BACKLIGHT_PIN,NEGATIVE);
// lcd.setBacklight(LED_OFF);
lcd.clear();
delay(100);
lcd.home();
lcd.setCursor(0,4);
lcd.print("Hi");
//lcd.setCursor(0,0xC0);
//lcd.print(" world");
//lcd.setCursor(1,9);
//lcd.print("my world!");
Serial.begin(9600);
}
void loop()
{
for (i=1;i<200;i++)
{
lcd.setCursor(i,0);
lcd.print("hi");
Serial.println (i);
delay (200);
lcd.clear();
}
}
The sketch works correctly on the first 8 lines but nothing appears on the second 8. The website linked above also says the second half of the line starts at 40 which is why I have the program counting up to 200 just to try to get something on the second set. I find it hard to believe that both my units have partially died in the same way. Can this be true?