Not able to find a answer

Why does this code create no errors

#define QPSKpuls D2
#define MODtype D3
#define LOCKled D4

and this does?

#define TFT_DC    D9    // 
#define TFT_CS    D10   // 
#define TFT_RST   D8

I put that

#define TFT_DC    D9    //
#define TFT_CS    D10   //
#define TFT_RST   D8

into an existing sketch and uploaded it to my uController, I did not get errors.

What errors?

gharryh:
Why does this code create no errors

#define QPSKpuls D2

#define MODtype D3
#define LOCKled D4



and this does?


#define TFT_DC D9 //
#define TFT_CS D10 //
#define TFT_RST D8

Wouldn't it have been simpler, and wasted much less time, to tell us what errors you are seeing, and under what circumstances?

groundFungus:
What errors?

D9 was not declared in this scope

Post the sketch where the error occurs

Show your full sketch (if too big, a smaller one that shows the behaviour). The problem might be on the line(s) before that.

Or you're using an Arduino that has less than 10 pins; which Arduino?

...and post the actual error message, not what you think it says.

We need to see the entire error message. Paraphrasing the error message leaves out important information. When you get a compile error in the IDE there will be a "copy error message" button in the lower right of the IDE window. Click that to copy the error and paste into a post in code tags.

Read the how to use this forum-please read sticky to see how to properly post code and some advice on how to ask an effective question. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.

are you sure these lines are not inside a bracket they shouldn't be?

taterking:
are you sure these lines are not inside a bracket they shouldn't be?

?

gharryh:
D9 was not declared in this scope

From your #define statements:

#define TFT_DC    D9    //

Whenever the compiler encounters TFT_DC, it will be replaced with D9. Apparently that is happening somewhere in your code where D9 has not yet been declared. As to where that is, noone here can tell, since you did not post the complete code, but it is odd that the other #define statements do not also lead to error messages, since digital pins are not referred to using 'D' followed by a number, but instead by just the number.

david_2018:
since digital pins are not referred to using 'D' followed by a number, but instead by just the number.

Isn't that different for ESP or Wemos or so? I don't have either so don't know.

gharryh:
Why does this code create no errors

#define QPSKpuls D2

#define MODtype D3
#define LOCKled D4



and this does?

#define TFT_DC    D9    //
#define TFT_CS    D10  //
#define TFT_RST  D8

Because #define statements do not work like C++ code - they work like a textual search-and-replace before the code is interperted as C. This means that those // are not treated like C++ comments - they are just treated as text to be inserted into the code. So eveytime you use TFT_CS elsewhere in your code, the rest of the line gets commented out.

sterretje:
Isn't that different for ESP

I, mainly, use ESP32's. I just use regular GPIO pin numbers. As an FYI.

PaulMurrayCbr:
Because #define statements do not work like C++ code - they work like a textual search-and-replace before the code is interperted as C. This means that those // are not treated like C++ comments - they are just treated as text to be inserted into the code. So eveytime you use TFT_CS elsewhere in your code, the rest of the line gets commented out.

Did you just imagine that?

Try this

// if the assertion that comments in a #define will cause errors,
// the substitution of the following #define will cause an error,
// because the comment will cause the semicolon (and closing parenthesis) NOT to be seen 
#define expectErrors  42 // or, will we..?

// NOT going to happen!

void setup() 
{
  Serial.begin (115200);
  Serial.print (F("The Answer is... "));
  Serial.println (expectErrors);
}

void loop() 
{}