LED Dice not working

My code is simple but long, i'm trying to make a LED dice with my UNO R3. I have already connected all the components to pins 2, 3, 4, 5, 6, 7, and the button on 8. Each LED has its own 330R resistor, but the code isn't working. Here it is:

#define button 8
#define a 2
#define b 3
#define c 4
#define d 5
#define e 6
#define f 7
int num;
void setup() {
  pinMode(a, OUTPUT);
  pinMode(b, OUTPUT);
  pinMode(c, OUTPUT);
  pinMode(d, OUTPUT);
  pinMode(e, OUTPUT);
  pinMode(f, OUTPUT);
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(e, LOW);
  digitalWrite(f, LOW);
  pinMode(button, INPUT_PULLUP);
}
void loop() {
  if(digitalRead(button) == 0) {
    num = random(1, 6);
    if(num == 1) {
      digitalWrite(a, HIGH);
      digitalWrite(b, LOW);
      digitalWrite(c, LOW);
      digitalWrite(d, LOW);
      digitalWrite(e, LOW);
      digitalWrite(f, LOW);
    } else if(num == 2) {
      digitalWrite(b, HIGH);
      digitalWrite(a, HIGH);
      digitalWrite(c, LOW);
      digitalWrite(d, LOW);
      digitalWrite(e, LOW);
      digitalWrite(f, LOW);
    } else if(num == 3) {
      digitalWrite(a, HIGH);
      digitalWrite(b, HIGH);
      digitalWrite(c, HIGH);
      digitalWrite(d, LOW);
      digitalWrite(e, LOW);
      digitalWrite(f, LOW);
    } else if(num == 4) {
      digitalWrite(a, HIGH);
      digitalWrite(b, HIGH);
      digitalWrite(c, HIGH);
      digitalWrite(d, HIGH);
      digitalWrite(e, LOW);
      digitalWrite(f, LOW);
    } else if(num == 5) {
      digitalWrite(a, HIGH);
      digitalWrite(b, HIGH);
      digitalWrite(c, HIGH);
      digitalWrite(d, HIGH);
      digitalWrite(e, HIGH);
      digitalWrite(f, LOW);
    } else if(num == 6) {
      digitalWrite(a, HIGH);
      digitalWrite(b, HIGH);
      digitalWrite(c, HIGH);
      digitalWrite(d, HIGH);
      digitalWrite(e, HIGH);
      digitalWrite(f, HIGH);
    }
  }
}

The button is connected between pin 8 and GND, since I'm using INPUT_PULLUP mode. What's the problem?

So what does happen when you press the button ?

First time i pressed it led 3 lighted up, now it's not doing anything. It's not a syntax error because the code does indeed get uploaded on the UNO.

It's time for some debugging

Print the value of num. What do you see when you press the button ?

Note that random(1, 6); will only give you values between 1 and 5 in any case

Ok, so I need to setup the serial? (serial.begin(9600); for example)

Yes

Okay

#define button 8
#define a 2
#define b 3
#define c 4
#define d 5
#define e 6
#define f 7
int num;
void setup() {
  serial.begin(9600);
  pinMode(a, OUTPUT);
  pinMode(b, OUTPUT);
  pinMode(c, OUTPUT);
  pinMode(d, OUTPUT);
  pinMode(e, OUTPUT);
  pinMode(f, OUTPUT);
  digitalWrite(a, LOW);
  digitalWrite(b, LOW);
  digitalWrite(c, LOW);
  digitalWrite(d, LOW);
  digitalWrite(e, LOW);
  digitalWrite(f, LOW);
  pinMode(button, INPUT_PULLUP);
}
void loop() {
  if(digitalRead(button) == 0) {
    num = random(1, 7);
    Serial.print(num);
}

It says serial not declared in this scope

This produces values from 1 to 5. Oops... I see now. Already mentioned.

UKHeliBob already told me that, but thanks

should be

Serial.begin(9600);

C/C++ is case sensitive.

Better still

Serial.begin(115200);

9600 is very slow. Don't forget to set the same speed in Serial Monitor.

Capital S in Serial.begin(); I have slow brain. Going to shovel some rocks.

Okay thanks, didnt know that...

It does not print anything in the serial monitor, even if i press the "reset" key

already got that wrong once on a project, and it was printing weird characters XD

Put this in setup(), on a new line after after Serial.begin()

Serial.println ("Starting!");

Wait, do I have to use println instead of print when i print the number?

You don't have to. If you just use Serial.print() it will print everything on the same line.

So are you seeing "Starting!" but nothing when you press the button?

How is the button wired?

Okay. Also it just says starting and nothing el- nvm i made it so i have to press the button to print the number