Shot roullete

Hello!
Some time ago I made a roulette led to some friends who own a cafe.

The initial idea was when the roulette stoped randomly in one of 12 LEDs, depending on color, the beer could be free, regular price or twice the normal price.

The code and the final product worked very well and, even today, are still used.

However, in conversation, we decided to make an extra cover to be able to switch between the game of beer and a new game of shot's.

The game consists of 12 different shots, one for each LED. The problem is that we need that when the wheel is spinning normally, if we click on one of the two buttons that we'll add, she has to stop random but obligatorily a set of 4 LEDs.

I am new at this and don't have the slightest idea what to do.

Can anyone help?

thank you

here's my code:

int led[12] = {41,40,39,38,37,36,35,34,33,32,31,30};

int del = 50; //delay

int aktuell = 0;

int zufall;

const int btnVodkaGroup = 11;
const int btnWhiskyGroup = 10;
int resetPin = 12;

int buttonState = 0;
int buttonState1 = 0;
int buttonState2 = 0;

void setup(){
   pinMode(btnVodkaGroup, INPUT);
   pinMode(btnWhiskyGroup, INPUT);
  for(int i = 0;i <= 11;i++){
    pinMode(led[i], OUTPUT);
  }
  randomSeed(analogRead(0));
  zufall = random(190, 210);
}
void(* resetFunc) (void) = 0;
void loop(){  
buttonState = digitalRead(resetPin);
if (buttonState == HIGH)
resetFunc(); }

normal();
}

void normal()
{  for(int i = 0;i <= 11;i++){
    if (del <= zufall)
    {
      laufen(i);
    }
    else
    {
      digitalWrite(led[aktuell], HIGH);
    }
  }
}

void laufen(int i){
    digitalWrite(led[i], HIGH);
    delay(del);
    digitalWrite(led[i], LOW);
    del+=2;
    aktuell = i;
}

roullete.txt (944 Bytes)

she has to stop random but obligatorily a set of 4 LEDs.

What does this mean? Do you mean that you want one of 4 LEDs to remain lit, and that the one to remain lit is chosen at random?

If so, what is the problem?

the roullette has 12 leds. 4 red, 4 yellow ánd 4 green, displayed in red/yellow/green and so on.

she must do the spin trough all leds, but when the button on pin 11 is pressed she must continue the spin and stop, for exemple, on one of the blue ones, and if the button on pin 10 is pressed she must also continue the spin and stop on one of the yellow ones.

she must do the spin trough all leds, but when the button on pin 11 is pressed she must continue the spin and stop, for exemple, on one of the blue ones, and if the button on pin 10 is pressed she must also continue the spin and stop on one of the yellow ones.

OK. So, what is the problem?

the problem is i don't know how to do it in code..

the problem is i don't know how to do it in code..

You don't know how to do what? You don't know how to determine if a switch is pressed? You don't know how to generate a random number? You don't know how to use that number to select the pin to leave high? You don't know how to stop the looping in the normal() function? You don't know when to call, or not call, the normal() function?

By the way, normal() is a stupid name for the function. It ways NOTHING about what the function actually does.

i don't know how to change the random value

i don't know how to change the random value

int lowerLimit = 0;
int upperLimit = 3;
int randomValue = random(lowerLimit, upperLimit+1);

thank you