How do you plan to solve it?
/*Paste your code here*/
#include <SPI.h>
#define PushButton 5
#define SS 9
void setup() {
pinMode(PushButton, INPUT_PULLUP); // push button
Serial.begin(9600);
Serial.println("=== SPI DICE ROLL - MASTER ===");
SPI.begin();
SPI.setDataMode(SPI_MODE0);
// pinMode(MOSI, OUTPUT); // Set MISO as OUTPUT to send data to the master
// pinMode(MISO, INPUT); // Set MISO as OUTPUT to send data to the master
// pinMode(SCK, OUTPUT); //
pinMode(SS, OUTPUT); //
digitalWrite(SS, HIGH);
}
void loop() {
int receivedNumber = 5;
bool but_val = digitalRead(PushButton);
// Check if button is pressed
if(but_val == 0)
{
// Debounce delay
delay(50);
// select the slave
digitalWrite(SS, LOW);
delayMicroseconds(10); // Small delay for slave to detect
receivedNumber = SPI.transfer(0x00);
delayMicroseconds(10);
digitalWrite(SS, HIGH); // deselect slave
Serial.print("you rolled a : ");
Serial.println(receivedNumber);
}
// Small delay before next roll
delay(1000);
}
Add a video of the output (know more)

Add a photo of your hardware showing the output.
Add a Screenshot of the serial terminal showing the output.
