The code below reads and displays info. such as WiFi MAC Address, Chip ID, Flash Chip ID, Flash Chip Size, etc. about the NodeMCU v1.0 board that I use for making this post.
#include <ESP8266WiFi.h>
void setup() {
Serial.begin(115200);
delay(500);
Serial.println();
Serial.println("ESP8266 Info.");
Serial.println("****************************************");
Serial.print("WiFi MAC: ");
Serial.println(WiFi.macAddress());
Serial.printf("Chip ID as a 32-bit integer:t%08Xn", ESP.getChipId());
Serial.printf("Flash chip ID as a 32-bit integer:tt%08Xn", ESP.getFlashChipId());
Serial.printf("Flash chip frequency:tttt%d (Hz)n", ESP.getFlashChipSpeed());
// ESP.getFlashChipSize() returns the flash chip size, in bytes as seen by the SDK (may be less than actual size).
Serial.printf("Flash chip size:tttt%d (bytes)n", ESP.getFlashChipSize());
Serial.printf("Free heap size:ttttt%d (bytes)n", ESP.getFreeHeap());
}
void loop() {
}
Reference:
1. http://esp8266.github.io/Arduino/versions/2.1.0/doc/libraries.html
2. http://arduino-er.blogspot.tw/2016/04/nodemcuesp8266-get-esp-chip-and-flash.html
3. https://techtutorialsx.com/2017/04/09/esp8266-get-mac-address/
Kegunaan ini adalah agar file hex dari suatu mikrokontroler hanya digunakan untuk mikrokontroler tertentu saja