Hello!
I’m trying to make my program translate a string into a morse code and display it with the LED flashing. But whenever I try to play my code it gives me errors that I do not understand. Here’s the full code (sorry for it being messy xD):
int WhtLed1 = 13;
void setup()
{
pinMode(WhtLed1, OUTPUT);
// Nustatom šviesos diodus į LOW.
digitalWrite(WhtLed1, LOW);
//Nustatom morzes abecele
int charlist[] = {65, 66};
int 65[] = {1000, 3000};
int 66[] = {3000, 1000, 1000, 1000}
int wlet = -1;
int k = -1;
}
void loop()
{
char text = "AA"
text.toCharArray(letters[],length(text));
for (i = 0;i < length(text);i + 1) {
int tcs = char letter[wlet+1]
for (j = 0;j< charlist[currentcharlist];j + 1) {
if (tcs == charlist[k+1]) {
for (l = 0; l < sifeof(tcs[]); l + 1) {
digitalWrite(WhtLed1, HIGH);
int h = 0;
delay(tsc[h+1]);
digitalWrite(WhtLed1, LOW);
delay(1000);
}
}
}
}
}
And here’s the error:
Arduino: 1.8.0 (Windows 10), Board: "Arduino/Genuino Uno"
C:\Users\Tech_Mokinys6\Desktop\Kristijono morzes kodo vertejas\morzes_kodo_vertejas\morzes_kodo_vertejas.ino: In function 'void setup()':
morzes_kodo_vertejas:12: error: expected unqualified-id before numeric constant
int 65[] = {1000, 3000};
^
morzes_kodo_vertejas:13: error: expected unqualified-id before numeric constant
int 66[] = {3000, 1000, 1000, 1000};
^
C:\Users\Tech_Mokinys6\Desktop\Kristijono morzes kodo vertejas\morzes_kodo_vertejas\morzes_kodo_vertejas.ino: In function 'void loop()':
C:\Users\Tech_Mokinys6\Desktop\Kristijono morzes kodo vertejas\morzes_kodo_vertejas\morzes_kodo_vertejas.ino:19:13: warning: invalid conversion from 'const char*' to 'char' [-fpermissive]
char text = "AA"
^
morzes_kodo_vertejas:20: error: expected ',' or ';' before 'text'
text.toCharArray(letters[],length(text));
^
morzes_kodo_vertejas:21: error: 'i' was not declared in this scope
for (i = 0;i < length(text);i + 1) {
^
morzes_kodo_vertejas:21: error: 'length' was not declared in this scope
for (i = 0;i < length(text);i + 1) {
^
morzes_kodo_vertejas:22: error: expected primary-expression before 'char'
int tcs = char letter[wlet+1]
^
morzes_kodo_vertejas:23: error: 'j' was not declared in this scope
for (j = 0;j< charlist[currentcharlist];j + 1) {
^
morzes_kodo_vertejas:23: error: 'charlist' was not declared in this scope
for (j = 0;j< charlist[currentcharlist];j + 1) {
^
morzes_kodo_vertejas:23: error: 'currentcharlist' was not declared in this scope
for (j = 0;j< charlist[currentcharlist];j + 1) {
^
exit status 1
expected unqualified-id before numeric constant
Thanks! :3