Flash sequence numbers

Don't know if i am posting in the right place but here it goes,
I keep getting
'letters' was not declared in this scope
I am using nano and here is my code

const int dotDelay = 200;
const int redPin = 13;
const int bluePin = 12;

char message [] = "Hello";

void setup()
{

pinMode (redPin, OUTPUT);
pinMode (bluePin,OUTPUT);
Serial.begin (9600);

{

}

void loop();

char ch;
if (Serial.available() > 0)
{
ch = Serial.read();
if (ch >= 'a' && ch <= 'z')
{
flashSequence(letters[ch - 'a']);
}
else if (ch >= 'A' && ch <= 'Z')

{

flashSequence(letters[ch - 'A']);

}

else if(ch >= '0' && ch<='9')

{

flashSequence(numbers[ch - '0']);

}
else if (ch == ' ')

(
(dotDelay * 4 );

}
}
}

First of all I recommend that you read the topic:

Because it appears that you haven't done it yet, as recommended when registering on the forum.

Then, redo your topic by placing your code between tags by clicking " < code > " in the toolbar.

And finally, I don't believe that your code when compiling gave just this error that you report, as there are so many errors in your code that it is difficult to try to correct it.

I even tried, but gave up after the tenth mistake.....

look...... " void loop(); " ????

1 Like

Please edit your post to add code tags. (<code/> editor button).

The posted code attempts to use, but does not declare or define a char array called letters. It also calls a function called "flashSequence()" which is not defined.

Please explain what this code supposed to do.

1 Like

()
const int dotDelay = 200;
const int redPin = 13;
const int bluePin = 12;

void setup()
{

pinMode (redPin, OUTPUT);
pinMode (bluePin,OUTPUT);
Serial.begin (9600);

{

}

void loop();

char ch;
if (Serial.available() > 0)
{
ch = Serial.read();
if (ch >= 'a' && ch <= 'z')
{
flashSequence(letters[ch - 'a']);
}
else if (ch >= 'A' && ch <= 'Z')

{

  flashSequence(letters[ch - 'A']);

}

else if(ch >= '0' && ch<='9')

{

flashSequence(numbers[ch - '0']);

}
else if (ch == ' ')

(
(dotDelay * 4 );

}
}
}

trying to blink morris code//
says letters not declared

Before correcting the minor details, you are missing a major function called:

flashSequence();

Do you have a link showing where you copied this code?

[edit]

I found your "morse code" sketch in many places... all copy/paste and messed up, for example:

... then I found this site which successfully copy/pasted, without error, from an old Arduino Project Hub... but the original sketch died along with assembly instructions in the destruction of Project Hub

When you copy/paste, be sure to get all the program data.

Here is a simple one I made...

1 Like

Thank you for your help and I do believe that i know how to post now.
I will try the missing function called flashSequence();
No sir do not have a link , but i referenced the book, programming Arduino

See post #4 post #6 in the merged thread... I posted the link to morse code projects.

I have merged your cross-posts @raiders9691.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.