SPI Master and Slave Library
If you don't have VS Code you can install from here. After downloading click extensions and type and install PlatformIO IDE. Then select your arduino board and upload. Source codes have to be located in /src folder, so if you want to upload slave code then move master.cpp to /test and slave.cpp back to /src folder. Libraries are located in /lib.
For demonstrating purpose it could have multiple slaves, but it is okay that all the slaves have the same code.
Usage for Master
Master master; // creating Master type variable.
master.setup(SLAVE_PIN); // setup the master.
master.setCurrentAngle(7); // set the currentAngle variable. master.setMotorID(8); // set the motorID variable. master.setTargetAngle(9); // set the targetAngle variable.
master.enable(SLAVE_PIN); // opening the slave for transmission.
master.write(SLAVE_PIN); // sending the data from bus.
master.disable(SLAVE_PIN); // closing the slave for transmission.
Usage for Slave
Slave slave; // creating Slave type variable.
slave.setup(); // setup the slave.
slave.read(slave); // reading the data from bus.