ESP32 w/ PlatformIO error


New member
Hello everyone, I just purchased the Crystalfontz 128x56. I am adding this to a project that I am working on in PlatformIO and receive build errors. If built in the Arduino app, everything compiles fine however, I would like to use PlatformIO (C++).

Does anyone have a rewrite with the cpp file versus the ino file? If not, can anyone assist me with the errors:

PORTB was not declared in this scope
DDRC was not declared in this scope

for the PORTB and PORTC I rewrote like the following which may have resolved that particular:
//#define CLR_CS (PORTB &= ~(0x01)) //pin #8 - Chip Enable Signal
//#define SET_CS (PORTB |= (0x01)) //pin #8 - Chip Enable Signal

Thanks in advance
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.

CF Kelsey

Staff member
Hi, I'm not super familiar with ESP32, but all this section of code is doing is telling the arduino to output high when the "SET_CS" is called and low when "CLR_CS" is called on the first pin of port B (aka, pin 8 on the arduino).

DDRC sets whether pins are inputs or outputs.

It looks like this person had a similar question and got some help: