BASIC4MCU | 질문게시판 | 답변 : 아두이노 LCD 글자 출력질문입니다.
페이지 정보
작성자 master 작성일2023-06-10 19:27 조회440회 댓글0건본문
#include <LiquidCrystal.h>
#include <avr/io.h>
LiquidCrystal lcd(22,23,24,25,26,27); // RS-22,E-23,D4-24,D5-25,D6-26,D7-27
//
bool run=0,flag=0;
int i=0;
//
void setup(){
lcd.begin(16,2);
lcd.setCursor( 0,0); lcd.print("Mecha!");
lcd.setCursor(10,1); lcd.print("Induk!");
PORTC=0x0F;
wait_key();
}
//
void wait_key(){
while(!PINC&0x10); delay(100); // 누를 때까지 대기
while( PINC&0x10); delay(100); // 뗄 때까지 대기
run=!run;
if(run)return;
while(!PINC&0x10); delay(100); // 누를 때까지 대기
while( PINC&0x10); delay(100); // 뗄 때까지 대기
run=!run;
}
//
void key_chk(){
if(PINC&0x10)wait_key();
}
//
void loop(){
for(int i=0;i<10;i++){
lcd.clear();
lcd.setCursor( i,0); lcd.print("HELLO!");
lcd.setCursor(10-i,1); lcd.print("BYEBE!");
delay(200);
key_chk();
}
//------------------------------------
for(int i=0;i<10;i++){
lcd.clear();
lcd.setCursor(10-i,0); lcd.print("HELLO!");
lcd.setCursor( i,1); lcd.print("BYEBE!");
delay(200);
key_chk();
}
}
여러가지 방법이 있겠지만 이 코드로 돌려보세요
댓글 0
조회수 440등록된 댓글이 없습니다.