Code hangs with SPI, and OLED labraries (Possible conflict between Adafruit SSD1306 and hardware SPI libraries) I have an issue with using two libraries together, namely SPI.h that is installed together with an Arduino and Adafruit_SSD1306.h. My code was getting stuck so I stripped it down to the bare minimum to find where the problem occurs. Here's the stripped down code:
#include &lt;SPI.h&gt;
#include &lt;Wire.h&gt;
#include &lt;Adafruit_SSD1306.h&gt;

//Screen Resoluttion
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_Res A3
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, OLED_Res);

#define _ssPin  7

void setup()   {  
  pinMode(OLED_Res, OUTPUT);
  pinMode(_ssPin, OUTPUT);
  Serial.begin(19200);
  Serial.println(&quot;Serial set up&quot;);   
  SPI.begin();     
  Serial.println(&quot;SPI set up&quot;);
  Wire.begin();
  Serial.println(&quot;I2C set up&quot;);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  Serial.println(&quot;Screen set up&quot;);
}

void loop()                    
{
  Serial.println(&quot;Loop entered&quot;);
}

I am debugging the code using serial monitor. The code as it stands right now hangs after I2C initialization. If I uncomment either SPI.begin() or display.begin(...) it jumps into the loop. Which leads me to think there might be a conflict between the two libraries. Which is weird considering I haven't found a similar issue on the internet and I doubt these two libraries are rarely used.
I used the same code provided by you and uploaded it in the arduino uno and it was working fine for me. I am attaching the image for reference. I guess there might be some other issue