how to connect two sensors with arduino mega with SPI connection?

Dear all,

i want to connect my arduino mega with accelerometer(CS2) and gyroscope(CS1) with SPI communication. I have already connected MISO, MOSI, and SCK. But i am confused regarding SS pin in Arduino mega because there is only one as per SPI - Arduino Reference. So, i want to know if it is possible to connect these two sensors with mega or not? If yes, in which pin should i connect?

any digital pin can be used as SS ( also known as CS and other names ) for a device connected to the Arduino. be sure to set pinMode(pinNumber, OUTPUT);

the SS pin on the Arduino can be used as SS if you only have 1 SPI device. this requires you to set that pin as OUTPUT, which is a good thing, because

if you set the pinMode(pinNumber, INPUT ) and pull the SPI SS pin low, the Arduino becomes the slave device, and whatever pulled the pin low becomes the master

the Arduino SPI works both ways.

Thank You Geek Emeritus. It solved my problem