For loop problem

Hello,
I am trying to learn the method of using a "for" loop however if I type in the word "for" then space; the program does not change the color of the text to indicate that it recognizes the code. I searched some old posts on this subject but still can't figure it out. I am running V 1.6.8 on a UNO board. The code below is where I inserted the "for" in the very simple "Blink" file in the built in examples. Hopefully this will be enough to get some help started and thank you in advance!

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the Uno and
  Leonardo, it is attached to digital pin 13. If you're unsure what
  pin the on-board LED is connected to on your Arduino model, check
  the documentation at http://www.arduino.cc

  This example code is in the public domain.

  modified 8 May 2014
  by Scott Fitzgerald
 */


// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
for (
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
  
}

Why does it matter what color the word is? The compiler hasn't a clue what color the IDE used.

Seems a large percentage of people here have never heard of Google....

A for loop has 3 primary expressions in it:

for (expression1; expression2; expression3)
{
// Statements controlled by loop
}

expression1 -- usually sets a counter variable that is to control the loop
expression2 -- a test that evaluates to logic true or false to determine whether to make another pass
throught the loop
expression3 -- usually a change in the value of the control variable initialized in expression1

Example:

   int i;

        // expression1    expression2    expression3
   for (i = 0;            i < 10;             i++) 
   {
      Serial.print("i = ");
      Serial.println(i);
   }

Your for loop does not define three expressions nor does it have a closing parenthesis. Also, if you look really closely at the color, does it look like black or Army Green?

Some people are color blind and some colors just don't "show up". I find the keywords difficult to see in their default colors. To change them, I went to the directory where the file that controls the colors is stored. For me, that's:

E:\Arduino1.6.8\lib\theme

and look for theme.txt. Rename that file to themeOld.txt and then load that file into your text editor and scroll down to

# STRUCTURES
editor.keyword3.style = #5E6D03,plain
editor.reserved_word.style = #5E6D03,plain

I changed both of these to:

# STRUCTURES
editor.keyword3.style = #0000FF,plain
editor.reserved_word.style = #0000FF,plain

Now save the file as theme.txt. (You can always go back to the original setup by restoring themeOld.txt to theme.txt.) This change makes the keywords blue, which is easier for me to see. You can use whatever RGB constnat works for you. Save the file, close the IDE (if it's open), and open the IDE. The keywords should now appear blue.

Yes I Googled it and no I'm not color blind. With my beginners experience: the color of a valid syntax would change from black to beige/brown to indicate that the program accepted the syntax. In this case the word for just stays black when typed in. I didn't finish it with three expressions or closing parenthsis as I didn't see the need two complete it if the process stalled at that very point. I was following a tutorial verbatum where the instructors "for" changed when mine did not. I completed the section of the lesson with the for loop command and when I used verify I would get error messages which I attributed to the IDE not reconciling the "for" syntax. Still beleive that is why the color change to make it simple for dummies like me.

Which version of the IDE are you using ?

Using 1.5.6-r2 the for keyword changes color when typed but it makes no difference at all to the operation of the IDE or the program.

If you really want it to change colour then there are ways of doing it but why bother ? Just because it changes colour does not mean that you have the syntax right, particularly as it changes colour after entering just the for keyword alone.

Post the program that you had trouble with and we will work out what the real problem is.

Ok,thanks........tomorrow

Back in my day, we coded using ed on a teletype and we were thankful!

Teletype?
You were lucky.
We 'ad to code wit' punched cards, which we bit into to make t'holes.
And before that, we 'ad to whittle t'program onto sticks, using flint knives.

AWOL:
Teletype?
You were lucky.
We 'ad to code wit' punched cards, which we bit into to make t'holes.
And before that, we 'ad to whittle t'program onto sticks, using flint knives.

http://dilbert.com/strip/1992-09-08

Regards,
Ray L.

@AWOL: Sounds very familiar. As a grad student, we'd pour over those punch cards for hours before submitting them for a job. You walked almost a mile to the lab where a hand would appear through a small window, take your card stack, handing back a piece of paper with a number on it. You would then start calling the lab after about 24 hours to see if your job was ready. Walk to the lab, pick up your output only to find out a comma was missing on card 666, column 32. Then you'd repeat the process.

That's the bad news.

The good news was that you spent some time debugging your code before you submitted it. Students today, with the IDE's like Visual Studio and virtually instantaneous feedback, simply throw an idea at the code and hope that it fixes the bug. I think it really destroyed the science/art of debugging.

we'd pour over those punch cards for hours before submitting them

What did you pour over them ?

I did all that and had to enter a few thousand Hex codes into the EEPROM programmer for my Senior project which used an embedded CDP1802. Worked the first time! 8^)

UKHeliBob:
What did you pour over them ?

I think it was caramel sauce.

econjack:
I think it was caramel sauce.

That's OK as long as it didn't have bits of sugar left in it, or extra bits of anything come to that.

Man, now reading all of the experienced "Old Timers" posts about using punch cards and what not; I can only hang my head in shame at my stupid/simple problem! Anyhow with some of the advice here, I now understand the "for" loop idea and did get it to function! My code is still simple and sloppy but maybe I'll get there eventually. Actually the word "for" actually is turning color which was my original concern. It is turning from black to grey which is barely detectable instead of black to orange or blue like the other syntax words. Might be foolish to obsess about but I might try econjack's suggestion and look into the directory to try and change the color. Thank you very much everyone for your help!

int LEDPin=10; //Pin connected to output#10  Declared as integer
int LEDPin2=13;  //Pin connected to output #13 Declared as integer
int LEDPinOnTime=2300;
int LEDPinOffTime=4000; 
int LEDPin2OnTime=2000;
int LEDPin2OffTime=2000;

void setup() {
  // put your setup code here, to run once:

pinMode (LEDPin,OUTPUT); 
pinMode (LEDPin2,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
for (int j=1; j<=10; j=j+1 ) {
digitalWrite(LEDPin,HIGH);
delay(LEDPinOffTime);
digitalWrite(LEDPin,LOW);
delay(LEDPinOffTime);
}
digitalWrite(LEDPin2,HIGH);
delay(LEDPin2OnTime);
digitalWrite(LEDPin2,LOW);
delay(LEDPin2OffTime);
}