【发布时间】:2016-09-27 09:28:01
【问题描述】:
当我编译我的程序时,我收到了这条消息
Sketch 使用 7,074 字节 (21%) 的程序存储空间。最大值为 32,256 字节。 全局变量使用 1,033 字节 (50%) 的动态内存,为局部变量留下 1,015 字节。最大值为 2,048 字节。
这条消息说明了什么?
这是我的代码
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
Serial.println("Scan PICC to see UID and type...");
}
void loop() {
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;//go to start of loop if there is no card present
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;//if ReadCardSerial returns 1, the "uid" struct (see MFRC522.h lines 238-45)) contains the ID of the read card.
}
// Dump debug info about the card. PICC_HaltA() is automatically called.
mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}
我也在闪烁的 LED 长针 13 上收到此消息
【问题讨论】:
-
不看代码不好说。然而,大程序内存使用是 Arduino 框架“通用性”的代价。大量使用
RAM可能是由字符串文字引起的,而没有使用_FlashStringHelper和F("literals")。其中一些被 Arduino Framework 使用(据我所知,大约是 200B)。 -
已上传代码
标签: arduino iot arduino-uno