Multiple SPI on Arduino MEGA 2650

Hello everyone,

For my first project I got a problem with SPI I think !

I use a Gameduino 2 LCD and pixy cam, both use SPI, apparently I can not use multiple device on SPI at the same time, did you have any solution for that?

My Gameduino show progress bar and value about temperature, humidity and dust PPM. My pixycam is used for color detection.

Thank you in advance guys !!

You cannot use the SPI bus to connect to two SPI devices at the same time, the data on the bus would conflict.

You can however send data to one SPI device and when thats done send data to or read from a seperate SPI device.

You can have multiple devices on a SPI bus but each device must have a separate CS pin. You control which device is being communicated with by setting its CS pin LOW and the CS pins for all the other devices on the bus HIGH. If you're using libraries to control the devices that will be done automatically and you only need to make sure the libraries are configured for the correct CS pin.

More information: https://www.arduino.cc/en/Reference/SPI