Blinking two different LED colours alternately

Hey guys,

I just got an arduino starter kit the other day and have worked through the basic exercises in the booklet provided. I thought I might try and write my own sketch today but have encountered a few dramas.

I've got my breadboard wired up with 4 LEDs (Red, Green, Red, Green) each hooked up to pins 13, 12, 11, and 10 respectively.
What I am trying to do is have the two pins with green LEDs light up for .25s and then shut off, immediately after which the red LEDs will turn on, and this will be in a loop.

Here is my sketch:

/*
Turn on pins 10 and 12 (Green LEDs), then off.
Turn on pins 11 and 13 (Red LEDs), then off.
*/

int redLed = 11, 13; // Red LEDs
int greenLed = 10, 12; // Green LEDs
int del = 250; //Delay of 0.25s between pin sets changing

void setup() {
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
}

void loop() {
digitalWrite(greenLed, HIGH);
delay(del);
digitalWrite(greenLed, LOW);
digitalWrite(redLed, HIGH);
delay(del);
digitalWrite(redLed, LOW);
}

The error message : 'expected unqualified-id before numeric constant' in reference to the line highlighted in red.

Thanks in advance for your help.

int redled1=11 ;
int redled2=13 ;

... and digitalWrite can only set ONE pin at a time

(fixed typo in code example - "oh yes, trying to be clever eh?" - the first ine now seays redled1)

Every member here will say this is the right time to eschew delay() and embrace Blink Without Delay. Before delay() gets too permanently burned into your mind, it really will stand you in good stead for the future to look past it.

Apart from that linked example, there a number of places you could go and look: try the first two posts of this thread, and if you like video, have a look at this.

Try something like this:

// Blink without delay State Machine JDS
// Constants
const int Green = 7;
const int Red = 8;

//Variables
byte GreenState = 0;
byte RedState = 0;
long PrevMillisGreen = 0;
long PrevMillisRed = 0;
long GreenInterval = 900;
long RedInterval = 200;
unsigned long CurrentMillis = millis();

void setup() {
  // put your setup code here, to run once:
  pinMode(Green, OUTPUT);
  pinMode(Red, OUTPUT);
  Serial.begin(9600);
  Serial.print(__FILE__ " " __DATE__ " " __TIME__);
  Serial.print("  IDE "); Serial.println(ARDUINO);
}

void loop() {
  // put your main code here, to run repeatedly:
  CurrentMillis = millis();
  if (CurrentMillis - PrevMillisGreen > GreenInterval)
  { GreenState = !GreenState;
    digitalWrite(Green, GreenState);
    PrevMillisGreen = CurrentMillis;
  }
  if (CurrentMillis - PrevMillisRed > RedInterval)
  { RedState = !RedState;
    digitalWrite(Red, RedState);
    PrevMillisRed = CurrentMillis;
  }
}

For more LEDs, just add more if statements.
You can set it up to have different on/off times, or even random times.