I need help with my Magic Morse project

I'm currently attempting to recreate this project. I'm using the code it provides, but I want to change some things. I'm brand new to Arduino and to coding in general. Could someone take a look at the code and help me make some changes?

Here is the schematic I just made. I wired the parts according to the code. Everything works how it should.

Here's what I've got it to do so far:

  • prints "SUPER MORSE CODER 3000"
  • small delay
  • screen clears
  • cursor moves to the upper left position

This is perfect. The only thing I have left is to figure out how to make the LED and buzzer turn on while the Morse key is being held down. So I want to use something similar to

MorseKeyState = !digitalRead(morseInPin);
if (MorseKeyState = true) {
  digitalWrite(LED, HIGH);    //Turns LED on
  digitalWrite(BUZ, HIGH);    //Turns buzzer on
} else {
  digitalWrite(LED, LOW);     //Turns LED off
  digitalWrite(LED, LOW);     //Turns buzzer off
}

for:

MorseKeyState = !digitalRead(morseInPin);

I'm getting the error

"'MorseKeyState' was not declared in this scope"

What this the correct way to declare MorseKeyState?

Is this the correct way to state the condition?

(MorseKeyState = true)

I also would like to know if it is possible to use a switch to turn the Arduino on and off.

I'de be grateful for any help/tips you have to offer

in the following statement the = operator is assignment

if (MorseKeyState = true) {

which assigns MorseKeyState the value true hence the the first part of of the if() is always executed try using the comparision operator

if (MorseKeyState == true) {

or even

if (MorseKeyState) {

if MorseKeyState is true etc

"'MorseKeyState' was not declared in this scope"

What this the correct way to declare MorseKeyState?

Assuming you want the variable to be an integer, at the start of the program before any functions put

int MorseKeyState;

That declares it as a global variable that can be accessed anywhere in your sketch.