Hi and thanks for any replies in advance.
I'm used to programming in various languages so don't need to be to basic.
Almost all languages that I've used I've been able to create a 2 dimensional array which I don't think can be done here.
I've created a set of arrays for Morse Code.
As there doesn't seem to be a function to check the length of the array that I know of I've had to create an array to hold the length of each array and then I know how far to look into it.
This is all very long winded and makes for an awful lot of code.
To explain I have.....
int codeLen[38] {2,4,4,.......} - This then holds 38 numbers for then length of each array that holds the character.
I then have
boolean codeA[] = {0,1}
boolean codeB[] = {1,0,0,0}
....
....
....
As you can see it's not very good to shorten.
If I was to do this in most other languages I would have a two dimensional array that held all of the int arrays. This would then let me call just one array from code and only have a few lines.
With the way I have done this I have to create a switch case statement to cover all 38 characters resulting in lots of code.
Does anyone know of a shorter way to do this?
Below is my function that has the switch case in it and you can see how long it will get.
void runCode(char letter){
int codeSize = 0;
switch (letter) {
case 'A':
codeSize=codeLen[0];
for(int i=0;i<codeSize;i++){
ledFlasher(codeA[i]);
}
break;
case 'B':
codeSize=codeLen[1];
for(int i=0;i<codeSize;i++){
ledFlasher(codeB[i]);
}
break;
default:
break;
//
}
}