Post your code, but ultimately what you want to code is a state machine that changes state every time you press the button (you'll need to debounce the button, too - either externally with hardware, or on the Arduino with software).
So this is what ive got so far. I goes though all the lights and stops when you press the button. Id like to get it to change light every time the button is pressed
#include <Button.h>
/*
create a Button object at pin 12
connect button between pin 12 and GND
*/
Button button = Button(12,PULLDOWN);
void setup(){
pinMode(8,OUTPUT); //debug to led 13
pinMode(9,OUTPUT);
pinMode(7,OUTPUT);
}
if (button.isPressed() && button.wasPressed() && button.isPressed())
This is doing exactly the same thing.
Are you trying to change which LED is lit every time the switch is pressed, or are you trying to change which LED is lit only when the switch is held down?
You want to call the uniquePress function once in each pass through loop. If the function returns true, increment a counter.
Make the lights light up, and reset the counter, based on the value of the counter.
byte pressCount = 0;
void loop()
{
if(button.uniquePress())
pressCount++;
switch(pressCount)
{
case 1:
// Turn off all LEDs. Turn on 7
break;
case 2:
// Turn off all LEDs. Turn on 8
break;
case 3:
// Turn off all LEDs. Turn on 9
pressCount = 0;
break;
}
}