Code not working on Nano Every or ESP32

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?

jd_OLED.01.142_works_on_UNO_WIFI_R4.ino (2.1 KB)
DEV_Config.h (1.4 KB)
OLED_Driver.h (2.3 KB)
OLED_Driver.cpp (5.6 KB)
DEV_Config.cpp (1.8 KB)
GUI_Paint.cpp (27.4 KB)
GUI_Paint.h (8.2 KB)
fonts.h (2.8 KB)
font8.cpp (17.4 KB)
font64.cpp (90.7 KB)
font24.cpp (76.1 KB)
font20.cpp (52.0 KB)
font16.cpp (40.9 KB)
font12.cpp (23.9 KB)

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.

Define "doesn't work" precisely, please.

What doesn't it do that you expect it to do?

Does it not compile?

Does it compile but not run?

Does it run but not like you think it should?

What, EXACTLY, does it fail to do?

Details are everything. Vague hand waving complaints are of no use whatsoever.

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.

what specific OLED - give a link?
which ESP32 GPIO pins are used to connect it to the ESP32?
which Tools>Board have you selected?

CS - D10
COPI - D11
SCK - D13

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.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.