Go Down

Topic: 'PORTD' was not declared in this scope (Read 209 times) previous topic - next topic


I am currently writing a code to produce a tone on a NodeMCU and I keep getting an error message saying 'PORTD' was not declared in this scope  and I cant figure out how to fix it. Here's my code.

void setup(){

void loop(){

void playNote(int noteDelay){
     int x;
     PORTD |=0x01;
     PORTD &=0xFE;


You're trying to compile code for a processor that doesn't have a PORTD.
Please don't PM technical questions - post them on the forum, then everyone benefits/suffers equally


PORTD is an AVR thing.  NodeMCU has an ESP8266, on which "direct port IO" is different.

Go Up