“Include”的版本间的差异
来自YFRobotwiki
(以“#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...”为内容创建页面) |
|||
| (未显示1个用户的1个中间版本) | |||
| 第1行: | 第1行: | ||
| − | #include | + | <nowiki>#include</nowiki>用于调用代码以外的库。这允许代码能够访问大量的标准C库,同样包含Arduino自带的库。<br> |
| − | + | AVR C 库(Arduino 基于AVR标准语法) 语法手册请点击[http://www.nongnu.org/avr-libc/user-manual/modules.html 这里]。<br> | |
| − | + | '''注意: #include 与#define 相类似,不需要使用";"。如果加了编译器会提示错误。'''<br> | |
| + | |||
| + | |||
| + | <font color="orange" size="+1">'''示例'''</font> | ||
| + | |||
| + | 该示例使用了一个库,可将数据放入程序flash而不是ROM中。可以大大节省出更多存储空间派其他用途。。<br> | ||
| + | |||
| + | <pre style="color:dimgray"> | ||
| + | #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}; | ||
| + | </pre> | ||
| + | |||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | |||
| + | [[Arduino语法参考 | 返回Arduino语法参考列表]] | ||
| + | |||
| + | 更多建议和问题欢迎反馈至 [http://www.yfrobot.com YFRobot论坛] | ||
2017年9月10日 (日) 15:43的最后版本
#include用于调用代码以外的库。这允许代码能够访问大量的标准C库,同样包含Arduino自带的库。
AVR C库(Arduino基于AVR标准语法)语法手册请点击这里。
注意: #include与#define相类似,不需要使用";"。如果加了编译器会提示错误。
示例
该示例使用了一个库,可将数据放入程序flash而不是ROM中。可以大大节省出更多存储空间派其他用途。。
#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};
更多建议和问题欢迎反馈至 YFRobot论坛