Compilation failed & instructed me to post this on the forum

enum LedStates{ON, OFF};
LedStates ledState[8] = {ON, ON, ON, ON, ON, ON, ON, ON};
byte ledPin[8] = {2, 3, 4, 5, 6, 7, 8, 9};
int delayOff[8] = {1000, 900, 800, 700, 600, 500, 400, 300};
int delayOn[8] = {500, 450, 400, 350, 300, 250, 200, 150};
unsigned long chrono[8];
void blinkMachine(byte i) {
switch (ledState*) {*
case OFF: {
if (millis() – chrono >= delayOff*) {*
chrono = millis();
digitalWrite(ledPin*, HIGH);*
ledState = ON;
}
break;
}
case ON: {
if (millis() – chrono >= delayOn*) {*
chrono = millis();
digitalWrite(ledPin*, LOW);*
ledState = OFF;
}
break;
}
}
}
void setup() {
for (byte i = 0 ; i < 8 ; i++) {
pinMode(ledPin*, OUTPUT);*
digitalWrite(ledPin*, HIGH); }*
}
void loop() {
for (int i = 0 ; i < 8 ; i++) blinkMachine(i);
}
compiler message error.pdf (231 KB)
also message error.pdf (239 KB)

See here for help on the stray 342 problem.

Read the how to use this forum-please read sticky to see how to properly post code so that the forum sortware won't mess it up.

Use autoformat (ctrl-t or, in the IDE, Tools, Auto Format) to indent your code to improve readability.

This error typically happens when code is copied from some web pages. If this is what happened, here are some solutions:

  • Type the code in from scratch.

  • Use an editor that lets you delete unwanted characters. I think that the Norton Editor used to do this but I do not know what modern editors can do this.

  • Copy the code into a text editor. Copy the code out and paste into the Arduino IDE. Hope that the editor does not copy/paste characters such as \342.

Good Luck !

Oh, and what groundFungus wrote.

Ok I tried what Ground fungus wrote and it seems to only show a lot of others that had the same issue I did find the auto format although on my IDE it is called auto indent and does not show tools just the auto indent icon.
Still have the same problem. I also copied it into another text editor and then back to the IDE with the same results.
I was not able to see any other characters either using the IDE or the text editor or MS Excel.

A solution to the stray/ whatever problem that I have seen involves copying the code to this forum into code tags (as described in the how to use this forum sticky). Then click select and copy the code, from within the code tags, to the IDE. That will get rid of the unsupported characters.

The errors were caused by the characters used as minus signs at lines 20 and 28 of your code. Some stupid program thought an en dash (UTF-8 encoding in octal being 0342 0200 0223) would look "prettier" than a minus sign and automatically changed it, breaking the code.

You can dump it in a post, copy it and paste it in your sketch; you do not have to actually post.

The problem with the "current" sketch is that the arrays have to be referenced by an index.

switch (ledState) {

should be

switch (ledState[i]) {

and so on.

The reason for the incorrect array syntax in the code rickam1 posted here on the forum is that they didn't use code tags, so the forum interprets the [i] as markdown for italics (I had to use nobbc tags to get the [i] to show up).

This is why we should always use code tags.

Thanks Pert!!
Now it works it was the dashes not being minus signs. I can now continue learning.

Also Pert,

where do I learn about these tags that you refer to?

Thanks again
Rick

I put a link to the how to use this forum sticky in reply #5. That explains how to use code tags (see #7). I guess that you missed it.

Thank you Ground Fungus,

I did check that link before but was not able to find the code tags but this time I signed in and did see that topic. However my Arduino screen does not look like that. I think when I first started using Arduino I had more options but since then my system seems to have converted over to the online version which does not have all those icons and features. I would like to go back to the way it was and not depend on the online version but to be able to develop and try code when I am not connected to the internet. I also did not understand what sterretje was saying in # 11.

If you have not already you can download the offline version of the IDE from here.

OP, maybe you misunderstand.

Code tags are for the forum, not for the editor.

Thank you again Ground Fungus,

Now I finally got the original screen that I had when I first started using Arduino and before it converted over to the online version.

With Much appreciation
Rick

Thanks Again Ground fungus,

That worked and it is good to have that version back again,

Have a good weekend
Rick

Hello Pert & Sterretje,

I was finally able to find the code tags that you had referred to and now I see what you were asking for and will try to remember that if I need to post to the forum again. It looks like a better way to do things but I really do not understand all of the advantages of using them.

P.S. Sterretje I see in your tag that you were into electronics but moved to software; I've stayed in electronics and now wish that I had done more software.

Be well
Rick

The biggest advantage is how easy it is to copy the code to paste into the IDE or other editor to evaluate, verify or test the code. Another big advantage is that the forum software interprets certain marks in code as tags for text modification. For instance, using i for an array index () causes the text following as italic and removes all instances of the array indexer. Not good. Another that we see a lot is an 8 followed by a closing parenthesis. Like digitalRead(8);. Do you see a smiley face pin on your board. There are other reasons, but those are the main ones.