'DDRD' was not declared in this scope

Which Arduino do you have? There may be no port D.

Edit: NodeMCU is not an Arduino, so Arduino direct port access macros cannot be used.