用户工具

站点工具


en:reference:language:include

差别

这里会显示出您选择的修订版和当前版本之间的差别。


前一修订版
en:reference:language:include [2023/06/07 04:23] (当前版本) – 外部编辑 127.0.0.1
行 1: 行 1:
 +====== #include ======
 +
 +
 +#include is used to include outside libraries in your sketch. This gives the programmer access to a large group of standard C libraries (groups of pre-made functions), and also libraries written especially for Ocrobot.
 +
 +
 +The main reference page for AVR C libraries (AVR is a reference to the Atmel chips on which the Ocrobot is based) is here.
 +
 +
 +Note that #include, similar to #define, has no semicolon terminator, and the compiler will yield cryptic error messages if you add one.
 +===== Example =====
 +
 +This example includes a library that is used to put data into the program space flash instead of ram. This saves the ram space for dynamic memory needs and makes large lookup tables more practical.
 +
 +<code cpp>
 +#include <avr/pgmspace.h>
 +
 +prog_uint16_t myConstants[] PROGMEM = {0, 21140, 702  , 9128,  0, 25764, 8456,
 +0,0,0,0,0,0,0,0,29810,8968,29762,29762,4500};
 +</code>
 +