File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,41 @@ Artificially clearing them is a workaround to help saving precious heap.
152
152
153
153
Ref. `#1923 <https://github.com/esp8266/Arduino/issues/1923 >`__
154
154
155
+ Use custom defines from build options file
156
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
157
+
158
+ A file named ``build_opt.h `` next to the ``sketch.ino `` file enables the user
159
+ to specify custom definitons in a central and organized location.
160
+
161
+ The following code is a slightly modified Blink example sketch. It opens the
162
+ possibility to define the ``WAIT_TIME `` between the LED state changes. If no
163
+ ``build_opt.h `` file is placed next to the sketch file, the default value will
164
+ be set as 1000ms in this example.
165
+
166
+ .. code :: cpp
167
+
168
+ #ifndef WAIT_TIME
169
+ #define WAIT_TIME 1000 // use 1000ms if not defined different
170
+ #endif
171
+
172
+ void setup() {
173
+ // initialize digital pin LED_BUILTIN as an output.
174
+ pinMode(LED_BUILTIN, OUTPUT);
175
+ }
176
+
177
+ void loop() {
178
+ digitalWrite(LED_BUILTIN, HIGH);
179
+ delay(WAIT_TIME);
180
+ digitalWrite(LED_BUILTIN, LOW);
181
+ delay(WAIT_TIME);
182
+ }
183
+
184
+ Place the following content in a file named ``build_opt.h `` at the same
185
+ location as the ``sketch.ino `` file to define the ``WAIT_TIME `` to 500ms.
186
+
187
+ .. code :: cpp
188
+
189
+ -DWAIT_TIME=500
155
190
156
191
Why is there a board generator and what about it ?
157
192
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments