Greetings , complete beginner here,I think I have just figured out addressing ,initializing,and library basics. I am learning by deductive reasoning and basically altering existing code to my requirements. Not really a true understanding but a partial view that works as I discover. It was a task to get the I2c 20x4 LCD to work with the uno I now have a functioning display but the lines of text resolve line 1 ,3, 2,4. Rather than 1,2,3,4,. the sketch is
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F,20,4); // set the LCD address
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
Serial.begin(9600); // Used to type in characters
//-------- Write characters on the display ----------------
// NOTE: Cursor Position: CHAR, LINE) start at 0
lcd.setCursor(3,0); //Start at character 4 on line 0
lcd.print("Hello, world!");
delay(1000);
lcd.setCursor(2,1);
lcd.print("From pharoah");
delay(1000);
lcd.setCursor(0,2);
lcd.print("20 by 4 Line Display");
lcd.setCursor(0,3);
delay(2000);
// 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");
}/--(end setup )---/
void loop() /----( LOOP: RUNS CONSTANTLY )----/
{
{
// when characters arrive over the serial port...
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());
}
}
}
}/* --(end main loop )-- */
/* ( THE END ) */