BASIC4MCU | 질문게시판 | TFT LCD 버튼값 출력하기 2번째 질문입니다! 제발 도와주세요ㅠㅠ
페이지 정보
작성자 쉘쉘김쉘쉘 작성일2020-03-01 10:20 조회5,506회 댓글0건본문
![]() | 답변 : TFT LCD에 버튼값 출력하기.. 제발 도와주세요ㅠTFT, LCD, 버튼값, 출력하기, 2번째, 질문입니다!, 제발, 도와주세요ㅠㅠ2020.02.29, LCD 출력은 정상이라고 가정하고버튼 체크하는 부분과 LCD 출력의 코드를 좀 봐드리죠//#include<MCUFRIEND_kbv.h>#include<Adafruit_GFX.h>//#defi… WWW.BASIC4MCU.COM |
우선 사용 장치는 아두이노 메가와 3.5인치 TFT 컬러 LCD모듈(ICE-1825) 입니다.
아래 소스는 밑에 그림처럼 LCD에
----------------
ㅣ HELLO! ㅣ
ㅣ1000 ㅣ
-----------------
2줄의 영어와 숫자가 표시되어 느린 속도로 깜빡거리게 하는 것입니다.
문제는 여기서 '1000'을 '0'으로 바꾸어 '0'부터 시작해서 버튼을 누를 때마다 1씩 올라가도록
버튼 값을 출력하려 하는데 버튼 값 출력하는 코딩은 아무리 찾아봐도 없어서..
혼자서 3일째 아무리 해도 안되고.. 계속 꼬여만가고.. 원인을 찾지 못해...
두번째 질문을 올립니다... ㅜㅜ
★★★ 제가 구현해보고 싶은것은
버튼을 아날로그7 또는 디지털 31번에 연결해서 손으로 누를때마다 글자 옆의 숫자( "HELLO : 0")가
올라가는 것입니다.
제발 도와주세요ㅜㅜ
* 제품 예제 소스
#include <MCUFRIEND_kbv.h>
#include <Adafruit_GFX.h> // Core graphics library
// wiring with UNO or Mega2560:
//--------------POWER Pins--------------------------------
// 5V connects to DC 5V
// GND connects to Ground
// 3V3 do not need to connect(NC)
//--------------LCD Display Pins--------------------------
// LCD_RD connects to Analog pin A0
// LCD_WR connects to Analog pin A1
// LCD_RS connects to Analog pin A2
// LCD_CS connects to Analog pin A3
// LCD_RST connects to Analog pin A4
// LCD_D0 connects to digital pin 8
// LCD_D1 connects to digital pin 9
// LCD_D2 connects to digital pin 2
// LCD_D3 connects to digital pin 3
// LCD_D4 connects to digital pin 4
// LCD_D5 connects to digital pin 5
// LCD_D6 connects to digital pin 6
// LCD_D7 connects to digital pin 7
//--------------SD-card fuction Pins ----------------------
//This Connection Only for UNO, Do not support Mega2560
//because they use different Hardware-SPI Pins
//SD_SS connects to digital pin 10
//SD_DI connects to digital pin 11
//SD_DO connects to digital pin 12
//SD_SCK connects to digital pin 13
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0// Assign human-readable names to some common 16-bit color values:
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
MCUFRIEND_kbv tft;
void setup(void) {
Serial.begin(9600);
Serial.println(F("TFT LCD test"));tft.reset();
uint16_t identifier = tft.readID();
if(identifier == 0x9325) {
Serial.println(F("Found ILI9325 LCD driver"));
} else if(identifier == 0x9328) {
Serial.println(F("Found ILI9328 LCD driver"));
} else if(identifier == 0x4535) {
Serial.println(F("Found LGDP4535 LCD driver"));
}else if(identifier == 0x7575) {
Serial.println(F("Found HX8347G LCD driver"));
} else if(identifier == 0x9595) {
Serial.println(F("Found HX8347-I LCD driver"));
} else if(identifier == 0x4747) {
Serial.println(F("Found HX8347-D LCD driver"));
} else if(identifier == 0x8347) {
Serial.println(F("Found HX8347-A LCD driver"));
}else if(identifier == 0x9341) {
Serial.println(F("Found ILI9341 LCD driver"));
}else if(identifier == 0x7783) {
Serial.println(F("Found ST7781 LCD driver"));
}else if(identifier == 0x8230) {
Serial.println(F("Found UC8230 LCD driver"));
}else if(identifier == 0x8357) {
Serial.println(F("Found HX8357D LCD driver"));
} else if(identifier==0x0101){
identifier=0x9341;
Serial.println(F("Found 0x9341 LCD driver"));
}else if(identifier==0x7793){
Serial.println(F("Found ST7793 LCD driver"));
}else if(identifier==0xB509){
Serial.println(F("Found R61509 LCD driver"));
}else if(identifier==0x9486){
Serial.println(F("Found ILI9486 LCD driver"));
}else if(identifier==0x9488){
Serial.println(F("Found ILI9488 LCD driver"));
}else {
Serial.print(F("Unknown LCD driver chip: "));
Serial.println(identifier, HEX);
Serial.println(F("If using the Adafruit 2.8\" TFT Arduino shield, the line:"));
Serial.println(F(" #define USE_ADAFRUIT_SHIELD_PINOUT"));
Serial.println(F("should appear in the library header (Adafruit_TFT.h)."));
Serial.println(F("If using the breakout board, it should NOT be #defined!"));
Serial.println(F("Also if using the breakout, double-check that all wiring"));
Serial.println(F("matches the tutorial."));
identifier=0x9486;
}
tft.begin(identifier);
}void loop(void) {
tft.fillScreen(BLACK);
unsigned long start = micros();
tft.setCursor(0, 0);
tft.setTextColor(RED); tft.setTextSize(1);
tft.print("Hello!");tft.println("1000");
tft.println();
tft.println();
/*
tft.println();
tft.setTextColor(GREEN);
tft.setTextSize(5);
tft.println("Groop");
tft.setTextSize(2);
tft.println("I implore thee,");
tft.setTextSize(1);
tft.println("my foonting turlingdromes.");
tft.println("And hooptiously drangle me");
tft.println("with crinkly bindlewurdles,");
tft.println("Or I will rend thee");
tft.println("in the gobberwarts");
tft.println("with my blurglecruncheon,");
tft.println("see if I don't!");*/
delay(1000);delay(1000);
}
댓글 0
조회수 5,506등록된 댓글이 없습니다.