Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c-preprocessor]

the macro preprocessor for the C and C++ computer programming languages.

1
vote
1answer
45 views

Segmentation fault and huge SRAM need for Serial.println

I have written my own 'assert' since I want to use it for both Windows and Arduino. The class is called from many files (about 10). AssertUtils.h: #pragma once #define assert(expr) AssertUtils::...
0
votes
0answers
46 views

where is avr\interrupt.h on a Windows installation?

I'm trying to move from the Arduino IDE to Visual Studio Code. I have a program that uses interrupt.h #include <avr/interrupt.h> but it's not being found because it's not on the include path. ...
2
votes
1answer
55 views

Syntax of binary Constants

I was trying to compile some Arduino code on the PC for testing when I noticed some strange syntax for numerical binary constants. Convetion seems to be to declare them like so: static const ...
5
votes
2answers
872 views

Detect if Serial1 and Serial2 are defined, at compile time

I have my library that uses Serial, Serial1 and Serial2 to establish various logging scenarios. Library user would define the config at class constructor, using simple byte constants like 0, 1 and 2. ...
0
votes
2answers
58 views

Preprocessing problem

I've a little problem, I'm trying to create a library with processor variables for tune it. So in .ino I declared my preprocessor var, but preprocessor variables appear not defined in my library. (...
7
votes
4answers
6k views

List of Arduino board preprocessor #defines

When one selects a board within Arduino IDE, a preprocessor definition is added to one of the behind-the-scenes files. After a lot of hunting and some good fortune I found that the format of this ...
23
votes
4answers
3k views

Why use an int variable for a pin when const int, enum or #define makes much more sense

Why do people use a variable to specify a pin number when the pin is unlikely to change throughout the execution of the code? Many times I see an int being used for a pin definition, int led = 13; ...