How do you plan to solve it?
#include <SPI.h>
#define CS 10
#define COPI 11
#define CIPO 12
#define SCK 13
#define but 2
void setup() {
// put your setup code here, to run once:
pinMode(CS,OUTPUT);
pinMode(COPI,OUTPUT);
pinMode(CIPO, INPUT_PULLUP);
pinMode(SCK,OUTPUT);
pinMode(but,INPUT_PULLUP);
SPI.begin();
SPI.beginTransaction(SPISettings(2000000,MSBFIRST,SPI_MODE2));
Serial.begin(115200);
digitalWrite(CS,HIGH);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(but) == 0){
digitalWrite(CS,LOW);
uint8_t data = SPI.transfer(0x00);
digitalWrite(CS,HIGH);
Serial.println("You Rolled a " + String(data));
delay(1000);
}
}

