Can not deactive SPI slaves's chip select

Hi everyone !

I have a problem with the SPI on the Arduino Uno board. Here my code for the MFRC522 RFID module, just read the Card ID and post to the serial port. It works perfectly but my next plan is use another spi slave, so I try to deactive the SPI slave's chip select with digitalWrite(chipSelectPin, HIGH) but it did not work. The module still can read the ID card.

How can i fix this. Thanks for any help !!!

ggrfid.ino (19.6 KB)

The MFRC522 functions will set chipSelectPin LOW when they want to talk to the MFRC522 and HIGH when done talking to the MFRC522.

See: Read_MFRC522() and Write_MFRC522()

There is no need for you to do any more that set it HIGH in setup(). The code for the other device will do the same for that device. Just set all chip-select pins to HIGH in setup().