





#include <Wire.h>
void setup()
{
	Wire.begin();
	Serial.begin(9600);
	while (!Serial); // Leonardo: wait for serial monitor
	Serial.println("\nI2C Scanner");
}
void loop()
{
	byte error, address;
	int nDevices;
	Serial.println("Scanning...");
	nDevices = 0;
	for(address = 1; address < 127; address++ ){
		Wire.beginTransmission(address);
		error = Wire.endTransmission();
		if (error == 0){
			Serial.print("I2C device found at address 0x");
			if (address<16) Serial.print("0");
			Serial.print(address,HEX);
			Serial.println(" !");
			nDevices++;
		}
		else if (error==4){
		Serial.print("Unknown error at address 0x");
		if (address<16) Serial.print("0");
		Serial.println(address,HEX);
		} 
	}
	if (nDevices == 0) Serial.println("No I2C devices found\n");
	else Serial.println("done\n");
	delay(5000); // wait 5 seconds for next scan
}


#include <LiquidCrystal_I2C.h>
// set the LcD address 0X27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0X27, 16, 2);
void setup(){
	lcd.init(); // initialize the lcd
	lcd.setCursor(3,0);
	lcd.print("Hello, world!");
	lcd.setCursor(2,1);
	lcd.print("Ywrobot Arduino!");
	lcd.setCursor(0,2);
	lcd.print("Arduino LCM IIC 2004");
	lcd.setCursor(2,3);
	lcd.print("Power By Ec-yuan!");
}
void loop(){
}
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
	// put your setup code here, to run once:
	lcd.init();
	
	lcd.setCursor(0, 0);  //커서 홈(0,0)
	lcd.print("1++++++++23---------45*******67########7"); 
	// 40문자 저장
	lcd.setCursor(0, 1);  // 커서홈 2행 1열(0, 1)
	lcd.print("1++++++++23--------45********67########8");
	// 40문자 저장
}
void loop()
{
	// put your main code here, to run repeatly:
	int n;
	
	for(n = 0; n < 80; n++){
		lcd.scrollDisplayLeft(); // 왼쪽으로 한 칸 씩 이동
		delay(500);
	}
	delay(4000);
	for(n = 0; n < 80; n++){
		lcd.scrollDisplayRight(); // 오른쪽으로 한 칸 씩 이동
		delay(500);
	}
	delay(4000);
}

LCD Custom Character Generator (maxpromer.github.io)
#include <LiquidCrystal_I2C.h>
// '신' 패턴
uint8_t name_s[8] = {0x09, 0x09, 0x15, 0x15, 0x01, 0x10, 0x10, 0x1F}; 
// '동' 패턴
uint8_t name_d[8] = {0x1F, 0x10, 0x1F, 0x04, 0x1F, 0x0E, 0x11, 0x0E}; 
// '욱' 패턴
uint8_t name_u[8] = {0x0E, 0x11, 0x0E, 0x1F, 0x04, 0x1F, 0x01, 0x01}; 
LiquidCrystal_I2C lcd(0x27, 16, 2); // lcd 객체 생성
void setup()
{
	lcd.init();
	lcd.createChar(0, name_s); // '신' 패턴 코드 0으로 저장
	lcd.createChar(1, name_d); // '동' 패턴 코드 1으로 저장
	lcd.createChar(2, name_u); // '욱' 패턴 코드 2으로 저장
}
void loop()
{
	lcd.setCursor(0,0);  //커서 2행 1열(0,1)
	lcd.print("Hello, Ardyino!")
	lcd.setCursor(0,1);
	lcd.print("My name is ");
	lcd.write(0);
	lcd.write(1);
	lcd.write(2);
}