LED gambling dice

Hi!

I am working on a project to make a gambling dice with arduino.
I have written the code and start it, but the IF doesnt work.
The LEDs whould only turn on if the voltage is over 2.5V.
Please help me.

Here is the code:

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600); 
  pinMode(53, OUTPUT);//    1
  pinMode(51, OUTPUT);//    2
  pinMode(49, OUTPUT);//    3
  pinMode(47, OUTPUT);//    4
  pinMode(45, OUTPUT);//    5
  pinMode(43, OUTPUT);//    6
  pinMode(41, OUTPUT);//    7
  randomSeed(analogRead(0));
}

void loop() {
  // put your main code here, to run repeatedly
  int sensorValue = analogRead(A0);

  float voltage = sensorValue * (5.0 / 1023.0);

  if(voltage>2,5)
  {

    digitalWrite(53,LOW);
    digitalWrite(51,LOW);
    digitalWrite(49,LOW);
    digitalWrite(47,LOW);
    digitalWrite(45,LOW);
    digitalWrite(43,LOW);
    digitalWrite(41,LOW);
    delay(2500);

    float x = random(1,7);
    Serial.println(x);
    Serial.println(voltage);



    if(x==1)
    {
      digitalWrite(53, LOW);
      digitalWrite(51,LOW);
      digitalWrite(49, LOW);
      digitalWrite(47, HIGH);
      digitalWrite(45, LOW);
      digitalWrite(43, LOW);
      digitalWrite(41, LOW);

    };
    if(x==2)
    {
      digitalWrite(53, LOW);
      digitalWrite(51,HIGH);
      digitalWrite(49, LOW);
      digitalWrite(47, LOW);
      digitalWrite(45, LOW);
      digitalWrite(43, HIGH);
      digitalWrite(41, LOW);
    };
    if(x==3)
    {
      digitalWrite(53, LOW);
      digitalWrite(51,HIGH);
      digitalWrite(49, LOW);
      digitalWrite(47, HIGH);
      digitalWrite(45, LOW);
      digitalWrite(43, HIGH);
      digitalWrite(41, LOW);
    };
    if(x==4)
    {
      digitalWrite(53, HIGH);
      digitalWrite(51,HIGH);
      digitalWrite(49, LOW);
      digitalWrite(47, LOW);
      digitalWrite(45, LOW);
      digitalWrite(43, HIGH);
      digitalWrite(41, HIGH);
    };
    if(x==5)
    {
      digitalWrite(53, HIGH);
      digitalWrite(51,HIGH);
      digitalWrite(49, LOW);
      digitalWrite(47, HIGH);
      digitalWrite(45, LOW);
      digitalWrite(43, HIGH);
      digitalWrite(41, HIGH);
    }; 
    if(x==6)
    {
      digitalWrite(53, HIGH);
      digitalWrite(51,HIGH);
      digitalWrite(49, HIGH);
      digitalWrite(47, LOW);
      digitalWrite(45, HIGH);
      digitalWrite(43, HIGH);
      digitalWrite(41, HIGH);
    };


    delay(2500);
  }
  else
  {
    
    digitalWrite(53,LOW);
    digitalWrite(51,LOW);
    digitalWrite(49,LOW);
    digitalWrite(47,LOW);
    digitalWrite(45,LOW);
    digitalWrite(43,LOW);
    digitalWrite(41,LOW);
  }
}

And what voltage would we be talking about here?

5V i think

  if(voltage>2,5)

There is your problem.

In your code, you need to be American and use a decimal point, not a comma.

Try this instead:

  if(voltage>2.5)

Thank you a lot.

alanmclean:
I think that the problem is in 5V

You are 5 years too late to help.

odometer:
In your code, you need to be American and use a decimal point, not a comma.

Not American. Brits always use decimal points, for example.

Oh, surprise surprise, there’s a whole Wikipedia article about it…