특징 (Features) :
복잡한 회로 구성없이 끼우기만 하면 배선은 해결됩니다.
글자가 나타나지 않을 때, 가변저항을 시계방향(오른쪽방향)으로 돌려주시면 글자가 나타납니다.
핀배치 (Pinout) :
특별한 연결없이 방향만 맞게 쉴드를 끼워주시면 됩니다.
각각의 버튼들은 아날로그 핀에 연결되어 있고 LCD의 핀들은 아두이노와 다음과 같이 연결됩니다.
따라서 아래의 핀들을 제외한 핀을 사용하고 싶을 때, 핀헤더를 납땜해서 이용할 수 있습니다.
구성품 (Component) :
아두이노 16x2 LCD 키패드 쉴드 x 1
참고자료 (noted items) :
프로그래밍 코드 예시 (Programming code Example) :
LCD 밝기 조절 예시 소스코드이니 참고바랍니다.
// include the library code:
#include
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
//Key message
char msgs[5][15] = {"Right Key OK ",
"Up Key OK ",
"Down Key OK ",
"Left Key OK ",
"Select Key OK" };
int adc_key_val[5] ={30, 150, 360, 535, 760 };
int NUM_KEYS = 5;
int adc_key_in;
int key=-1;
int oldkey=-1;
int brightness=250;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("test LCD Keypad 1");
}
void loop()
{
adc_key_in = analogRead(0); // read the value from the sensor
key = get_key(adc_key_in); // convert into key press
if (key != oldkey) // if keypress is detected
{
delay(50); // wait for debounce time
adc_key_in = analogRead(0); // read the value from the sensor
key = get_key(adc_key_in); // convert into key press
if (key != oldkey)
{
oldkey = key;
if (key==1)
{
brightness+=25;
if(brightness>250) brightness=0;
analogWrite(10,brightness);
show_brightness();
lcd.setCursor(0, 1); //x=0, line=2
lcd.print("brightness: ");
}
if(key==2)
{
brightness-=25;if(brightness<0) brightness=250;
analogWrite(10,brightness);
show_brightness();
}
}
}
}
int show_brightness(void)
{
int temp;
lcd.setCursor(12, 1); //x=12, line=2
temp=brightness/25;
if(temp>9)
lcd.print("100%");
else
{
lcd.print(temp%10+'0');
lcd.print("% ");
}
}
// Convert ADC value to key number
int get_key(unsigned int input)
{
int k;
for (k = 0; k < NUM_KEYS; k++)
{
if (input < adc_key_val[k])
{
return k;
}
}
if (k >= NUM_KEYS)
k = -1; // No valid key pressed
return k;
}
참고자료 (noted items) :
메카솔루션 커뮤니티 Mechasolution Blog는 다양한 정보를 제공합니다.
상품이 장바구니에 담겼습니다.
바로 확인하시겠습니까?
상품이 찜 리스트에 담겼습니다.
바로 확인하시겠습니까?
Copyright © Mechasolution. All rights reserved.









