Morse code transmitter project not working buttons lcd issue

so im new with arduino based project and i was making a morse code transmitter but apparently this isnt working idk where is the problem i kinda make this circuit by diff tutorials can any one help my lcd is not showing anything and buttons not working led high


here is a picture

#include <LiquidCrystal_I2C.h>
#include <Wire.h>

// Pin definitions
int led = 8;
int button = 3;
int transmit = 10;

// Variables
int go = 0;
int len = 0;
String fin = "";
String morse_array[50];
int test = 0;
int m_inc = 0;
char m_in[5];
String translated = "";
String morsecode[] = {
".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....",
"..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.",
"--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-",
"-.--", "--..", " "
};
String alpha[] = {
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
"q", "r", "s", "t", "u", "v", "w", "x", "y", "z", " "
};

// Initialize the LCD library with the I2C address 0x3F and dimensions 16x2
LiquidCrystal_I2C lcd(0x3F, 16, 2);

void setup() {
pinMode(led, OUTPUT);
pinMode(button, INPUT);
pinMode(transmit, INPUT);
lcd.begin(16, 2);
lcd.backlight(); // Turn on the backlight
Serial.begin(9600);
}

void loop() {
if (Serial.available() > 0) {
String ad = Serial.readString(); // Read the incoming string
char charBuf[50];
ad.toCharArray(charBuf, 50);
len = ad.length();
convert_to_morse(charBuf);
Serial.println(morse_array[0]);
output_morse(morse_array);
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(fin);

if (digitalRead(transmit) == LOW) { 
    delay(300);
    if (digitalRead(transmit) == HIGH) {
        convert();
    } else {
        while (digitalRead(transmit) == LOW) {
            check_button();
        }
    }
}

}

void check_button() {
if (digitalRead(button) == LOW) {
delay(300);
if (digitalRead(button) == HIGH) {
m_in[m_inc] = '.';
m_inc++;
test = 1;
} else {
m_in[m_inc] = '-';
m_inc++;
test = 2;
delay(400);
}
}
}

void convert() {
for (int i = 0; i < 5; i++) {
translated += m_in[i];
}
translated.trim();
Serial.print(translated);
for (int i = 0; i < 27; i++) {
if (translated == morsecode[i]) {
fin += alpha[i];
}
}
translated = "";
m_inc = 0;
}

void convert_to_morse(char *charBuf) {
for (int i = 0; i < len; i++) {
for (int j = 0; j < 27; j++) {
if (charBuf[i] == alpha[j][0]) {
morse_array[i] = morsecode[j];
}
}
}
}

void output_morse(String morse_array[]) {
fin = "";
for (int i = 0; i < len; i++) {
fin += morse_array[i];
fin += " ";
}
Serial.println(fin);
}
code im using

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help

@alyinamalik - Re-format your code in the IDE, then inside the edited message, use the < CODE > button and paste your formatted code where you see '''type or paste code here'''

This is how your code should look:

#include <LiquidCrystal_I2C.h>
#include <Wire.h>

// Pin definitions
int led = 8;
int button = 3;
int transmit = 10;

// Variables
int go = 0;
int len = 0;
String fin = "";
String morse_array[50];
int test = 0;
int m_inc = 0;
char m_in[5];
String translated = "";
String morsecode[] = {
  ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....",
  "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.",
  "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-",
  "-.--", "--..", " "
};
String alpha[] = {
  "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
  "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", " "
};

// Initialize the LCD library with the I2C address 0x3F and dimensions 16x2
LiquidCrystal_I2C lcd(0x3F, 16, 2);

void setup() {
  pinMode(led, OUTPUT);
  pinMode(button, INPUT);
  pinMode(transmit, INPUT);
  lcd.begin(16, 2);
  lcd.backlight(); // Turn on the backlight
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() > 0) {
    String ad = Serial.readString(); // Read the incoming string
    char charBuf[50];
    ad.toCharArray(charBuf, 50);
    len = ad.length();
    convert_to_morse(charBuf);
    Serial.println(morse_array[0]);
    output_morse(morse_array);
  }
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(fin);

  if (digitalRead(transmit) == LOW) {
    delay(300);
    if (digitalRead(transmit) == HIGH) {
      convert();
    } else {
      while (digitalRead(transmit) == LOW) {
        check_button();
      }
    }
  }

}

void check_button() {
  if (digitalRead(button) == LOW) {
    delay(300);
    if (digitalRead(button) == HIGH) {
      m_in[m_inc] = '.';
      m_inc++;
      test = 1;
    } else {
      m_in[m_inc] = '-';
      m_inc++;
      test = 2;
      delay(400);
    }
  }
}

void convert() {
  for (int i = 0; i < 5; i++) {
    translated += m_in[i];
  }
  translated.trim();
  Serial.print(translated);
  for (int i = 0; i < 27; i++) {
    if (translated == morsecode[i]) {
      fin += alpha[i];
    }
  }
  translated = "";
  m_inc = 0;
}

void convert_to_morse(char *charBuf) {
  for (int i = 0; i < len; i++) {
    for (int j = 0; j < 27; j++) {
      if (charBuf[i] == alpha[j][0]) {
        morse_array[i] = morsecode[j];
      }
    }
  }
}

void output_morse(String morse_array[]) {
  fin = "";
  for (int i = 0; i < len; i++) {
    fin += morse_array[i];
    fin += " ";
  }
  Serial.println(fin);
}
  1. Remove all your wires and devices.
  2. Place the LCD on the breadboard, wire it correctly to your Arduino and upload an example sketch for LCD only.
  3. Place the buttons on the breadboard, wire them, test them alone (not with the LCD).
  4. Use your original code and put all your devices together correctly.
  5. Report your observations at any time you need help.

[edit]
Try using a simulation to help learn your code. Here is an example morse simulation:

Hi @alyinamalik ,

hmm, you do realize everything is wrong with that picture..
that's not showing an i2c screen, buttons are wrong, led is wrong..

how about a real pic, take one with your phone??

and sorry, even with the formatting and code tags, your logic eludes me..
do see a vast amount of Strings, which on an Uno is probably not a good design choice..

but I can say for sure, that code wont run on that pic, period..

good luck.. ~q

thanks bro but i tried it again my lcd and buttons are working but not my code ig i need urgent help if u can pls i will attach my circuit picture too

#include <LiquidCrystal.h>

// Pin definitions
const int ledPin = 13;
const int buttonDotDashPin = 7;
const int buttonEnterClearPin = 9;
const int backlightPin = 6;
const int backlightContrast = 20;

// Create the LCD object
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// Morse code timings (in milliseconds)
const int dotDuration = 100;
const int dashDuration = 300;
const int debounceDelay = 50;
const int enterDuration = 100;
const int clearDuration = 300;
const int resetDuration = 600;

// Variables to store Morse code
String morseBuffer = "";
bool morseMode = false;

void setup() {
// Set up the LCD's number of columns and rows
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(" 9/11");

// Set up the pins
pinMode(ledPin, OUTPUT);
pinMode(buttonDotDashPin, INPUT_PULLUP);
pinMode(buttonEnterClearPin, INPUT_PULLUP);

// Set LCD backlight contrast
analogWrite(backlightPin, backlightContrast);
}

void loop() {
// Read button states
bool buttonDotDashState = digitalRead(buttonDotDashPin) == LOW;
bool buttonEnterClearState = digitalRead(buttonEnterClearPin) == LOW;

// Enter Morse mode with a long press on button 1
if (!morseMode && buttonDotDashState) {
long pressStartTime = millis();
while (digitalRead(buttonDotDashPin) == LOW) {
if (millis() - pressStartTime > 1000) {
morseMode = true;
lcd.clear();
lcd.print("Morse Mode");
delay(1000); // Wait before starting Morse entry
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter code:");
lcd.setCursor(0, 1);
break;
}
}
}

if (morseMode) {
// Check for dot or dash input
if (buttonDotDashState) {
long pressStartTime = millis();
while (digitalRead(buttonDotDashPin) == LOW); // Wait for release
long pressDuration = millis() - pressStartTime;

  if (pressDuration >= dashDuration) {
    morseBuffer += '-';
    transmitDash();
  } else if (pressDuration >= dotDuration) {
    morseBuffer += '.';
    transmitDot();
  }
}

// Check for enter or clear input
if (buttonEnterClearState) {
  long pressStartTime = millis();
  while (digitalRead(buttonEnterClearPin) == LOW); // Wait for release
  long pressDuration = millis() - pressStartTime;

  if (pressDuration >= resetDuration) {
    lcd.clear();
    lcd.print("  9/11");
    morseBuffer = "";
    morseMode = false;
  } else if (pressDuration >= clearDuration) {
    morseBuffer = "";
    lcd.setCursor(0, 1);
    lcd.print("                "); // Clear the display
    lcd.setCursor(0, 1);
  } else if (pressDuration >= enterDuration) {
    transmitMorse(morseBuffer);
    morseBuffer = "";
  }
  delay(debounceDelay); // Simple debounce
}

}
}

// Function to display a character from Morse code
void transmitMorse(String morseCode) {
char letter = getLetterFromMorse(morseCode);
lcd.setCursor(0, 1);
lcd.print(letter);
}

// Function to convert Morse code to a letter
char getLetterFromMorse(String morseCode) {
if (morseCode == ".-") return 'A';
if (morseCode == "-...") return 'B';
if (morseCode == "-.-.") return 'C';
if (morseCode == "-..") return 'D';
if (morseCode == ".") return 'E';
if (morseCode == "..-.") return 'F';
if (morseCode == "--.") return 'G';
if (morseCode == "....") return 'H';
if (morseCode == "..") return 'I';
if (morseCode == ".---") return 'J';
if (morseCode == "-.-") return 'K';
if (morseCode == ".-..") return 'L';
if (morseCode == "--") return 'M';
if (morseCode == "-.") return 'N';
if (morseCode == "---") return 'O';
if (morseCode == ".--.") return 'P';
if (morseCode == "--.-") return 'Q';
if (morseCode == ".-.") return 'R';
if (morseCode == "...") return 'S';
if (morseCode == "-") return 'T';
if (morseCode == "..-") return 'U';
if (morseCode == "...-") return 'V';
if (morseCode == ".--") return 'W';
if (morseCode == "-..-") return 'X';
if (morseCode == "-.--") return 'Y';
if (morseCode == "--..") return 'Z';
return '?'; // For unknown codes
}

// Function to blink the LED for a dot
void transmitDot() {
digitalWrite(ledPin, HIGH);
delay(dotDuration);
digitalWrite(ledPin, LOW);
delay(gapDuration);
}

// Function to blink the LED for a dash
void transmitDash() {
digitalWrite(ledPin, HIGH);
delay(dashDuration);
digitalWrite(ledPin, LOW);
delay(gapDuration);
}
thanks bro i need to submit it in morning can you help

Are you deliberately ignoring the request to use code tags when posting code ?

sorry..

idk ive been qworking on this project for a week now still cant make the buttons work my lcd is showing the initial display text but after pressing buttons nothing is working can any one help btw heres my circuit


Your two or more topics on the same or similar subject have been merged.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

#include <LiquidCrystal.h>

// Pin definitions
const int ledPin = 13;
const int buttonDotDashPin = 7;
const int buttonEnterClearPin = 8;
const int backlightPin = 6;
const int backlightContrast = 20;

// Create the LCD object
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// Morse code timings (in milliseconds)
const int dotDuration = 100;
const int dashDuration = 300;
const int debounceDelay = 50;
const int enterDuration = 100;
const int clearDuration = 300;
const int resetDuration = 600;

// Variables to store Morse code
String morseBuffer = "";
bool morseMode = false;

void setup() {
  // Set up the LCD's number of columns and rows
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("  9/11");

  // Set up the pins
  pinMode(ledPin, OUTPUT);
  pinMode(buttonDotDashPin, INPUT_PULLUP);
  pinMode(buttonEnterClearPin, INPUT_PULLUP);

  // Set LCD backlight contrast
  analogWrite(backlightPin, backlightContrast);
}

void loop() {
  // Read button states
  bool buttonDotDashState = digitalRead(buttonDotDashPin) == LOW;
  bool buttonEnterClearState = digitalRead(buttonEnterClearPin) == LOW;

  // Enter Morse mode with a long press on button 1
  if (!morseMode && buttonDotDashState) {
    long pressStartTime = millis();
    while (digitalRead(buttonDotDashPin) == LOW) {
      if (millis() - pressStartTime > 1000) {
        morseMode = true;
        lcd.clear();
        lcd.print("Morse Mode");
        delay(1000); // Wait before starting Morse entry
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("Enter code:");
        lcd.setCursor(0, 1);
        break;
      }
    }
  }

  if (morseMode) {
    // Check for dot or dash input
    if (buttonDotDashState) {
      long pressStartTime = millis();
      while (digitalRead(buttonDotDashPin) == LOW); // Wait for release
      long pressDuration = millis() - pressStartTime;

      if (pressDuration >= dashDuration) {
        morseBuffer += '-';
        transmitDash();
      } else if (pressDuration >= dotDuration) {
        morseBuffer += '.';
        transmitDot();
      }
    }

    // Check for enter or clear input
    if (buttonEnterClearState) {
      long pressStartTime = millis();
      while (digitalRead(buttonEnterClearPin) == LOW); // Wait for release
      long pressDuration = millis() - pressStartTime;

      if (pressDuration >= resetDuration) {
        lcd.clear();
        lcd.print("  9/11");
        morseBuffer = "";
        morseMode = false;
      } else if (pressDuration >= clearDuration) {
        morseBuffer = "";
        lcd.setCursor(0, 1);
        lcd.print("                "); // Clear the display
        lcd.setCursor(0, 1);
      } else if (pressDuration >= enterDuration) {
        transmitMorse(morseBuffer);
        morseBuffer = "";
      }
      delay(debounceDelay); // Simple debounce
    }
  }
}

// Function to display a character from Morse code
void transmitMorse(String morseCode) {
  char letter = getLetterFromMorse(morseCode);
  lcd.setCursor(0, 1);
  lcd.print(letter);
}

// Function to convert Morse code to a letter
char getLetterFromMorse(String morseCode) {
  if (morseCode == ".-") return 'A';
  if (morseCode == "-...") return 'B';
  if (morseCode == "-.-.") return 'C';
  if (morseCode == "-..") return 'D';
  if (morseCode == ".") return 'E';
  if (morseCode == "..-.") return 'F';
  if (morseCode == "--.") return 'G';
  if (morseCode == "....") return 'H';
  if (morseCode == "..") return 'I';
  if (morseCode == ".---") return 'J';
  if (morseCode == "-.-") return 'K';
  if (morseCode == ".-..") return 'L';
  if (morseCode == "--") return 'M';
  if (morseCode == "-.") return 'N';
  if (morseCode == "---") return 'O';
  if (morseCode == ".--.") return 'P';
  if (morseCode == "--.-") return 'Q';
  if (morseCode == ".-.") return 'R';
  if (morseCode == "...") return 'S';
  if (morseCode == "-") return 'T';
  if (morseCode == "..-") return 'U';
  if (morseCode == "...-") return 'V';
  if (morseCode == ".--") return 'W';
  if (morseCode == "-..-") return 'X';
  if (morseCode == "-.--") return 'Y';
  if (morseCode == "--..") return 'Z';
  return '?'; // For unknown codes
}

// Function to blink the LED for a dot
void transmitDot() {
  digitalWrite(ledPin, HIGH);
  delay(dotDuration);
  digitalWrite(ledPin, LOW);
  delay(gapDuration);
}

// Function to blink the LED for a dash
void transmitDash() {
  digitalWrite(ledPin, HIGH);
  delay(dashDuration);
  digitalWrite(ledPin, LOW);
  delay(gapDuration);
}
here is the code

yeah i did that every thing is fine but still my code is not working

Fails to compile..
missing the gapDuration declaration..

Added that, idk, seems to do something??
first hold down black button till prompted to enter codes,
then enter codes..
hold down reset for a decent time, then release, it resets..

is that not what you are after??

Your project in a simulator..

good luck.. ~q

Describe this.

it would be nice if OP were to fix all the post missing the code tags... This thread looks ugly - no incentive to help out.

See post 11.

This is not right...

  bool buttonDotDashState = digitalRead(buttonDotDashPin) == LOW;
  bool buttonEnterClearState = digitalRead(buttonEnterClearPin) == LOW;

Try this...

  bool buttonDotDashState = digitalRead(buttonDotDashPin);
  bool buttonEnterClearState = digitalRead(buttonEnterClearPin);

This is looking for a HIGH on buttonDotDashState...

  if (!morseMode && buttonDotDashState) {

You want a LOW...

  if (!morseMode && !buttonDotDashState) {

Now, you can enter MORSE MODE with a LOOOONG press. I found it nearly impossible to stay within the 200ms of LONG vs SHORT press cutoff of your program... and I could reliably transmit at 5wpm about 40 years ago form my HAM license.

You might consider a "paddle" style button, meaning, one button is DIT the other button is DAH (the paddle uses left/right for dit/dah). This would eliminate human timing, and put the timing on the microcontroller.

Files for WOKWI.COM:

sketch.ino
#include <LiquidCrystal.h>

// Pin definitions
const int ledPin = 13;
const int buttonDotDashPin = 7;
const int buttonEnterClearPin = 8;
const int backlightPin = 6;
const int backlightContrast = 20;

// Create the LCD object
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// Morse code timings (in milliseconds)
const int dotDuration = 100;
const int gapDuration = 100;
const int dashDuration = 300;
const int debounceDelay = 50;
const int enterDuration = 100;
const int clearDuration = 300;
const int resetDuration = 600;

// Variables to store Morse code
String morseBuffer = "";
bool morseMode = false;

void setup() {
  // Set up the LCD's number of columns and rows
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("  9/11");

  // Set up the pins
  pinMode(ledPin, OUTPUT);
  pinMode(buttonDotDashPin, INPUT_PULLUP);
  pinMode(buttonEnterClearPin, INPUT_PULLUP);

  // Set LCD backlight contrast
  analogWrite(backlightPin, backlightContrast);
}

void loop() {
  // Read button states
  // bool buttonDotDashState = digitalRead(buttonDotDashPin) == LOW;
  // bool buttonEnterClearState = digitalRead(buttonEnterClearPin) == LOW;
  bool buttonDotDashState = digitalRead(buttonDotDashPin);
  bool buttonEnterClearState = digitalRead(buttonEnterClearPin);

  // Enter Morse mode with a long press on button 1
  if (!morseMode && !buttonDotDashState) {
    long pressStartTime = millis();
    while (digitalRead(buttonDotDashPin) == LOW) {
      if (millis() - pressStartTime > 1000) {
        morseMode = true;
        lcd.clear();
        lcd.print("Morse Mode");
        delay(1000); // Wait before starting Morse entry
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print("Enter code:");
        lcd.setCursor(0, 1);
        break;
      }
    }
  }

  if (morseMode) {
    // Check for dot or dash input
    if (buttonDotDashState) {
      long pressStartTime = millis();
      while (digitalRead(buttonDotDashPin) == LOW); // Wait for release
      long pressDuration = millis() - pressStartTime;

      if (pressDuration >= dashDuration) {
        morseBuffer += '-';
        transmitDash();
      } else if (pressDuration >= dotDuration) {
        morseBuffer += '.';
        transmitDot();
      }
    }

    // Check for enter or clear input
    if (buttonEnterClearState) {
      long pressStartTime = millis();
      while (digitalRead(buttonEnterClearPin) == LOW); // Wait for release
      long pressDuration = millis() - pressStartTime;

      if (pressDuration >= resetDuration) {
        lcd.clear();
        lcd.print("  9/11");
        morseBuffer = "";
        morseMode = false;
      } else if (pressDuration >= clearDuration) {
        morseBuffer = "";
        lcd.setCursor(0, 1);
        lcd.print("                "); // Clear the display
        lcd.setCursor(0, 1);
      } else if (pressDuration >= enterDuration) {
        transmitMorse(morseBuffer);
        morseBuffer = "";
      }
      delay(debounceDelay); // Simple debounce
    }
  }
}

// Function to display a character from Morse code
void transmitMorse(String morseCode) {
  char letter = getLetterFromMorse(morseCode);
  lcd.setCursor(0, 1);
  lcd.print(letter);
}

// Function to convert Morse code to a letter
char getLetterFromMorse(String morseCode) {
  if (morseCode == ".-") return 'A';
  if (morseCode == "-...") return 'B';
  if (morseCode == "-.-.") return 'C';
  if (morseCode == "-..") return 'D';
  if (morseCode == ".") return 'E';
  if (morseCode == "..-.") return 'F';
  if (morseCode == "--.") return 'G';
  if (morseCode == "....") return 'H';
  if (morseCode == "..") return 'I';
  if (morseCode == ".---") return 'J';
  if (morseCode == "-.-") return 'K';
  if (morseCode == ".-..") return 'L';
  if (morseCode == "--") return 'M';
  if (morseCode == "-.") return 'N';
  if (morseCode == "---") return 'O';
  if (morseCode == ".--.") return 'P';
  if (morseCode == "--.-") return 'Q';
  if (morseCode == ".-.") return 'R';
  if (morseCode == "...") return 'S';
  if (morseCode == "-") return 'T';
  if (morseCode == "..-") return 'U';
  if (morseCode == "...-") return 'V';
  if (morseCode == ".--") return 'W';
  if (morseCode == "-..-") return 'X';
  if (morseCode == "-.--") return 'Y';
  if (morseCode == "--..") return 'Z';
  return '?'; // For unknown codes
}

// Function to blink the LED for a dot
void transmitDot() {
  digitalWrite(ledPin, HIGH);
  delay(dotDuration);
  digitalWrite(ledPin, LOW);
  delay(gapDuration);
}

// Function to blink the LED for a dash
void transmitDash() {
  digitalWrite(ledPin, HIGH);
  delay(dashDuration);
  digitalWrite(ledPin, LOW);
  delay(gapDuration);
}
diagram.json
{
  "version": 1,
  "author": "Anonymous maker",
  "editor": "wokwi",
  "parts": [
    { "type": "wokwi-arduino-nano", "id": "nano", "top": -4.8, "left": -0.5, "attrs": {} },
    {
      "type": "wokwi-led",
      "id": "led1",
      "top": -99.6,
      "left": 109.4,
      "attrs": { "color": "red", "flip": "" }
    },
    {
      "type": "wokwi-pushbutton",
      "id": "btn1",
      "top": -70.6,
      "left": -19.2,
      "attrs": { "color": "green" }
    },
    {
      "type": "wokwi-pushbutton",
      "id": "btn2",
      "top": -70.6,
      "left": 144,
      "attrs": { "color": "green" }
    },
    { "type": "wokwi-lcd1602", "id": "lcd1", "top": -246.17, "left": -60.8, "attrs": {} }
  ],
  "connections": [
    [ "nano:GND.2", "btn2:2.l", "black", [ "v0" ] ],
    [ "nano:8", "btn1:1.r", "green", [ "v0" ] ],
    [ "nano:GND.2", "btn1:2.r", "black", [ "v0" ] ],
    [ "nano:GND.2", "led1:C", "black", [ "v0" ] ],
    [ "nano:7", "btn2:1.l", "green", [ "v0" ] ],
    [ "nano:13", "led1:A", "green", [ "v9.6", "h96" ] ],
    [ "nano:12", "lcd1:RS", "green", [ "v-19.2", "h57.6", "v-76.8", "h-96" ] ],
    [ "nano:11", "lcd1:E", "green", [ "v-19.2", "h48", "v-76.8", "h-67.2" ] ],
    [ "nano:5", "lcd1:D4", "green", [ "v-19.2", "h-9.6", "v-76.8", "h-9.6" ] ],
    [ "nano:4", "lcd1:D5", "green", [ "v-19.2", "h-19.2", "v-76.8" ] ],
    [ "nano:3", "lcd1:D6", "green", [ "v-19.2", "h-28.8", "v-76.8", "h9.6" ] ],
    [ "nano:2", "lcd1:D7", "green", [ "v-19.2", "h-38.4", "v-76.8", "h19.2" ] ]
  ],
  "dependencies": {}
}

code

see posts 2 and 6...

The rest of the world reads front to back, not back to front.

My points