Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Characters display on TFT by using Arduino

Status
Not open for further replies.

imranahmed

Advanced Member level 3
Advanced Member level 3
Joined
Dec 4, 2011
Messages
817
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
Karachi,Pakistan
Activity points
6,493
Please let me know I want to display text on TFT by using Arduino and 3x4 Keypad (I know it has numbers not text but they are in character form not String). Program works well but when I press key on keypad then other key it was printing only one character in a position and other prints on same position not move forward to print one by one characters like 12345.
Code:
#include "Nextion.h"
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {2, 3, 4, 5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {6, 7, 8}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
NexText tSeven = NexText(7,5,"t7");

char buffer[10];

void setup() {
 Serial.begin(9600);
 nexInit();
}
void loop() { 
char key = keypad.getKey();
if(key){
  sprintf(buffer, "%2c", key);
  tSeven.setText(buffer);
} }
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top