One momentary switch toggling multiple LEDs

Hello,
I have a good knowledge of building electrical circuits (guitar amps, repairing TVs etc) however this digital stuff is new to me. I bought the Arduino starter kit and am having a lot of fun. I figured out how to toggle a momentary switch for one LED (took me a week), but now I would like to know how to toggle multiple LEDs with one momentary switch. I'm not looking for the code, just a nudge in the right direction so that I can learn this on my own.
Thanks All
Arduino Rookie

Set up a counter, increment it with every button push.
For each count, turn on/off different LEDs:

switch(counter){
case 0:
// LEDs on/off
break;
case 1:
// LEDs on/off
break;
case 2:
// LEDs on/off
break;
case 3:
// LEDs on/off
break;
}

Thanks for the info. Forgive my ignorance. Should this command be in Loop or Setup?

Setup is what you do to get everything ready

Loop is what runs the whole show, continuously looking for inputs and making decisions to execute accordingly.

If you have got a toggle running, then you should understand that the switch needs to be debounced (and by the way, that code example for some perverse reason, shows the pushbutton connected to Vcc and a pull-down resistor, instead of the button going to ground and using the internal pull-up in the MCU).

All you then need to do is to put the sequence logic for the multiple LEDs, in place of the code:

    if (state == HIGH)
      state = LOW;
    else
      state = HIGH;

Thanks for the info Paul,
Still can't figure it out. Trying to use one momentary switch to control three LED's. First press pin 3 High, second press pin 3 low and pin 4 high, etc...
I have my input at pin 2 and outputs are 3,4,and 5. What am I doing wrong? Any help would be greatly appreciated.
Thanks, Frank

Post the code.

Insert it between the two "code" tags in your message, that you generate by clicking on the "hash" (#) symbol above.

I have no experience of fixing electronic's but I do understand something's related to it. I am now retired and want to do some electronic projects as a hobby having bought Arduino uno and a mega 2560 boards all I get is:-

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
C:\Users\liamd_000\Desktop\University Course\Arduino\hardware\tools\avr\bin\avr-g++ returned 3

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
C:\Users\liamd_000\Desktop\University Course\Arduino\hardware\tools\avr\bin\avr-g++ returned 3

That is not just my sketches but the examples too. So not one person's code sketch is working Verify and Upload just get the above errors.
even moving to another location like desk top did not help same error. ports work fine. boards are working just the codes will not be allowed to run. Any help out there for a 60 year old newbie very keen but not getting started is a Problem.

Something missing in your IDE - on the computer itself, not the Arduino.

Perhaps - dare I say it - try re-installing the software.

I have installed it again and the same results so it is the computer at fault. Toshibas and Microsoft have different views on whether I can have windows 8 so I am one minute in windows 7 and then in 8 it seems to me.

I was going to ask what hardware and OS you're using, but it sounds as if you may not know. If you can't decide whether it's Windows 7 or Windows 8 then perhaps the installer has been confused similarly and not managed a full installation. It would be worth looking in the windows and application event logs for any errors around the time the IDE crashed, especially side-by-side (SxS) errors.

int counter = 0;
void setup (){
pinMode (2, INPUT);
pinMode (3, OUTPUT);
pinMode (4, OUTPUT);
pinMode (5, OUTPUT);
}
void loop(){
switch (counter){
case 0:
digitalWrite (3, LOW);
digitalWrite (4, LOW);
digitalWrite (5, LOW);
break;
case 1:
digitalWrite (3, HIGH);
digitalWrite (4, LOW);
digitalWrite (5, LOW);
break;
case 2:
digitalWrite (3, HIGH);
digitalWrite (4, HIGH);
digitalWrite (5, LOW);
break;
case 3:
digitalWrite (3, HIGH);
digitalWrite (4, HIGH);
digitalWrite (5, HIGH);
break;
}
}

Here is what I've got.

Here is what I've got.

Does it do what you want? If not, what is the problem?

The Sketch does nothing. Do I need to give a switch command to each case?

The Sketch does nothing.

Yes, it does. It turns pins 3, 4, and 5 off.

Since counter never changes, it is unreasonable to expect the sketch to ever do anything but turn the three pins off.

Thanks Paul,
Your response just turned the lights on in my head (not the circuit yet). I really appreciate your help and tolerance of my Arduino ignorance.
Frank

and tolerance of my Arduino ignorance.

It's only ignorance if you are not trying to learn. I don't sense that that is the case. In fact, I get the distinct impression that you ARE trying to learn. Keep asking questions. Keep trying things.

I'm assuming I'm going to use if and else statements for each case. Am I right?

I'm assuming I'm going to use if and else statements for each case.

For what? The whole purpose of a switch statement with cases is to avoid a whole set of if/else if statements.

What does counter represent?

OK, OK, I give up. I'm trying to do something that I'm sure is a very simple sketch, just can't wrap my head around it. Could someone show me a sketch that uses one momentary switch to toggle between multiple LEDs? I think that might get me rolling.
Thanks,
Embarrassed Newbie.

Could someone show me a sketch that uses one momentary switch to toggle between multiple LEDs?

I'm beginning to think that your inability to write code that does what you want is directly tied to your inability to express what it is you want.

What does "toggle between multiple LEDs" mean?