질문게시판 > TFT LCD 버튼값 출력하기 2번째 질문입니다! 제발 도와주세요ㅠㅠ

TODAY429 TOTAL2,679,136
사이트 이용안내
Login▼/회원가입
최신글보기 질문게시판 기술자료 동영상강좌

아두이노 센서 ATMEGA128 PWM LED 초음파 AVR 블루투스 LCD UART 모터 적외선


BASIC4MCU | 질문게시판 | TFT LCD 버튼값 출력하기 2번째 질문입니다! 제발 도와주세요ㅠㅠ

페이지 정보

작성자 쉘쉘김쉘쉘 작성일2020-03-01 10:20 조회5,506회 댓글0건

본문

	

우선 사용 장치는 아두이노 메가와 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);

 

  • BASIC4MCU 작성글 SNS에 공유하기
  • 페이스북으로 보내기
  • 트위터로 보내기
  • 구글플러스로 보내기

댓글 0

조회수 5,506

등록된 댓글이 없습니다.

질문게시판HOME > 질문게시판 목록

MCU, AVR, 아두이노 등 전자공학에 관련된 질문을 무료회원가입 후 작성해주시면 전문가가 답변해드립니다.
ATMEGA128PWMLED초음파
아두이노AVR블루투스LCD
UART모터적외선ATMEGA
전체 스위치 센서
질문게시판 목록
제목 작성자 작성일 조회
공지 MCU, AVR, 아두이노 등 전자공학에 관련된 질문은 질문게시판에서만 작성 가능합니다. 스태프 19-01-15 19170
공지 사이트 이용 안내댓글[28] master 17-10-29 34060
질문 stm32f767 스텝모터 속도 질문있습니다 새글 123132 23-05-27 12
질문 아트메가 128 코딩 오류 질문입니다.댓글[1] 새글 태태킴 23-05-27 12
질문 스텝모터 제어하는 소스파일인데 질문있습니다. 새글 Bs드리프터 23-05-27 16
답변 답변글 답변 : 스텝모터 제어하는 소스파일인데 질문있습니다. 새글 master 23-05-27 20
질문 모터 컨트롤러와 웜기어 모터 연결 문의 드립니다댓글[2] 새글 오후에 23-05-27 13
답변 답변글 답변 : 모터 컨트롤러와 웜기어 모터 연결 문의 드립니다댓글[1] 새글첨부파일 오후에 23-05-27 14
질문 아두이노 스텝모터 초음파 결합댓글[2] 새글 결합기원 23-05-26 24
답변 답변글 답변 : 아두이노 스텝모터 초음파 결합 새글 master 23-05-27 11
질문 piezo부저 연결 방법댓글[2] 이미지새글첨부파일 djwb 23-05-26 17
질문 Atmega128과 도트매트릭스을 이용해 16x16미로찾기 새글 JJEE 23-05-26 25
답변 답변글 답변 : Atmega128과 도트매트릭스을 이용해 16x16미로찾기 새글 master 23-05-26 17
질문 아두이노 mq3 센서 여러개댓글[5] 새글 keyest 23-05-26 31
질문 아두이노 이어폰모듈 elb080306댓글[1] 크라퀴 23-05-25 19
질문 어제 아두이노 핀 문제댓글[2] 미ㅏㄴㅇ 23-05-25 30
질문 스텝 모터, 모터 드라이버 관련 질문입니다댓글[2] 스튜와트 23-05-24 30
답변 답변글 답변 : 스텝 모터, 모터 드라이버 관련 질문입니다 이미지 master 23-05-24 21
질문 아두이노 디지털 핀 문제 미ㅏㄴㅇ 23-05-24 23
답변 답변글 답변 : 아두이노 디지털 핀 문제댓글[1] master 23-05-24 36
질문 아두이노 코드 합치기댓글[1] 아두초보이노 23-05-24 30
질문 마그네틱 도어센서 관련 질문드립니다. 엉아 23-05-23 22
답변 답변글 답변 : 마그네틱 도어센서 관련 질문드립니다.댓글[1] master 23-05-24 17
답변 답변글 답변 : 답변 : 마그네틱 도어센서 관련 질문드립니다. master 23-05-24 21
질문 토양습도센서 이용시LCD 오류댓글[5] 윤던 23-05-23 38
질문 ATMEGA 광센서 부저댓글[2] 코딩 23-05-23 40
질문 ATMEGA J-KIT 128 스위치 부저댓글[1] 이미지첨부파일 코딩 23-05-22 43
질문 장애물 회피 게임댓글[1] 첨부파일 헬창 23-05-20 56
질문 회로도 관련 질문댓글[1] 이미지첨부파일 dnjs 23-05-20 39
질문 Atmega FND 왼쪽 2칸엔 고정 오른쪽 2칸엔 1씩증가댓글[1] 초피 23-05-20 48
게시물 검색

2022년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2021년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2020년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2019년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2018년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
Privacy Policy
MCU BASIC ⓒ 2020
모바일버전으로보기