this code works on UNO R4 WIFI, but it doesn't on either Nano Every or Nano ESP32 (adapting to Nano ESP32 requires changing <avr/pgmspace.h> --> <avr/pgmspace.h>
MSBFIRST --> SPI_MSBFIRST). I made it work by getting rid of extra .h .cpp files and moving all the code into the .ino . But why didn't it work?
Start by reading the pinned post re 'How to get the most from the forum'. But I can already tell this will be difficult since you mentioned 'getting rid of EXTRA .h and .cpp files.
it compiles. This piece of software is a driver for an OLED display. it connects via SPI. By 'doesn't work' i mean the OLED won't turn on. It's unclear what exactly doesn't work. It looks like the clock signal (#13) is going out, but the required bits are not being sent out via SPI.
Whatever board is plugged in -- the correct board.
But you're missing the point. The code works, when it's all in one .ino file, but it doesn't work, when it's linked via #include .h .cpp -- the same code! For some reason the usual sharing the code across several files botches things up. As an experiment i can place Serial.println('whatever'); in .ino, and I would get 'whatever' in serial monitor -- but, if I put the same Serial.println('whatever') in Driver.cpp, there would be no message.