NRF24L01 Chat using the nokia 5110 display and push buttons.

hello I’m trying to add push buttons 5 of them each button is number 1,2,3 for button one 4,5,6 for button 2 789 for button 3 0 for button 4 and send text for button 5. so if i put button 1 i get number 1 if i push it two times i get 1 and 2 for the first button so if i hit the send button it sends number 12 in chat right now i can only send it in serial monitor i have no clue how to do that for the push buttons with this chat i really need help code is below can someone please help me?


RF24 radio(9, 10);
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
bool go_to_tx_mode = false;
char input[32] = "";

#define PIN_SCE   7 //Pin 3 on LCD
#define PIN_RESET 6 //Pin 4 on LCD
#define PIN_DC    5 //Pin 5 on LCD
#define PIN_SDIN  4 //Pin 6 on LCD
#define PIN_SCLK  3 //Pin 7 on LCD

//The DC pin tells the LCD if we are sending a command or data
#define LCD_COMMAND 0 
#define LCD_DATA  1

//You may find a different size screen, but this one is 84 by 48 pixels
#define LCD_X     84
#define LCD_Y     48

//This table contains the hex values that represent pixels
//for a font that is 5 pixels wide and 8 pixels high

void setup() {

  LCDInit(); //Init the LCD
 // printf_begin();
  radio.setRetries(15, 15);
  radio.openReadingPipe(1, pipes[0]);
  // put your setup code here, to run once:


void loop() {

if (go_to_tx_mode)
    bool ok = radio.write(input, 32);
    if (ok)
 //   printf("ME : %s\n", input);
LCDString( input);
      go_to_tx_mode = false;
 printf("could not write....\n");

 if (radio.available())
    char payload[32] = "";
    bool done = false;
    while (!done)
      done = payload , 32 );
LCDString( payload);
   // printf("HIM : %s\n", payload);
   // printf( payload);
  if (Serial.available())
    int len = Serial.readBytesUntil('\n', input, 31);
    input[len] = '\0';
    go_to_tx_mode = true;
 void gotoXY(int x, int y) {
  LCDWrite(0, 0x80 | x);  // Column.
  LCDWrite(0, 0x40 | y);  // Row.  ?

//This takes a large array of bits and sends them to the LCD
void LCDBitmap(char my_array[]){
  for (int index = 0 ; index < (LCD_X * LCD_Y / 8) ; index++)
    LCDWrite(LCD_DATA, my_array[index]);

//This function takes in a character, looks it up in the font table/array
//And writes it to the screen
//Each character is 8 bits tall and 5 bits wide. We pad one blank column of
//pixels on each side of the character for readability.
void LCDCharacter(char character) {
  LCDWrite(LCD_DATA, 0x00); //Blank vertical line padding

  for (int index = 0 ; index < 5 ; index++)
    LCDWrite(LCD_DATA, ASCII[character - 0x20][index]);
    //0x20 is the ASCII character for Space (' '). The font table starts with this character

  LCDWrite(LCD_DATA, 0x00); //Blank vertical line padding

//Given a string of characters, one by one is passed to the LCD
void LCDString(char *characters) {
  while (*characters)

//Clears the LCD by writing zeros to the entire screen
void LCDClear(void) {
  for (int index = 0 ; index < (LCD_X * LCD_Y / 8) ; index++)
    LCDWrite(LCD_DATA, 0x00);
  gotoXY(0, 0); //After we clear the display, return to the home position

//This sends the magical commands to the PCD8544
void LCDInit(void) {

  //Configure control pins
  pinMode(PIN_SCE, OUTPUT);
  pinMode(PIN_DC, OUTPUT);
  pinMode(PIN_SDIN, OUTPUT);
  pinMode(PIN_SCLK, OUTPUT);

  //Reset the LCD to a known state
  digitalWrite(PIN_RESET, LOW);
  digitalWrite(PIN_RESET, HIGH);

  LCDWrite(LCD_COMMAND, 0x21); //Tell LCD that extended commands follow
  LCDWrite(LCD_COMMAND, 0xB1); //Set LCD Vop (Contrast): Try 0xB1(good @ 3.3V) or 0xBF if your display is too dark
  LCDWrite(LCD_COMMAND, 0x04); //Set Temp coefficent
  LCDWrite(LCD_COMMAND, 0x14); //LCD bias mode 1:48: Try 0x13 or 0x14

  LCDWrite(LCD_COMMAND, 0x20); //We must send 0x20 before modifying the display control mode
  LCDWrite(LCD_COMMAND, 0x0C); //Set display control, normal mode. 0x0D for inverse

//There are two memory banks in the LCD, data/RAM and commands. This 
//function sets the DC pin high or low depending, and then sends
//the data byte
void LCDWrite(byte data_or_command, byte data) {
  digitalWrite(PIN_DC, data_or_command); //Tell the LCD that we are writing either to data or a command

  //Send the data
  digitalWrite(PIN_SCE, LOW);
  shiftOut(PIN_SDIN, PIN_SCLK, MSBFIRST, data);
  digitalWrite(PIN_SCE, HIGH);

i can not post the ASCII because the forum say i went over the limit of what i can post.

You can make attachments.

How to use this forum

ohhh because i couldn’t add the whole sketch in the forum i see. i will post it. i totally forgot because i never used it before. thank you.

What I’m trying to do is instead of typing in serial monitor i would like to use the push buttons to type the message but not sure how to do that.

_2waytextmessenger_nokia5100lcd.ino (17.5 KB)

Hello I'm trying to figure out how to write the text message in the chat using the push buttons instead of using serial monitor but no success yet i have no idea on how to make the text show up in the nokia 5110 on the last 2 lines and have send in the nrf24l01 chat. can someone please help me?