EEPROM.write()

[EEPROM]

描述

Write a byte to the EEPROM.

語法

EEPROM.write(address, value)

參數

  • address: the location to write to, starting from 0 (int)
  • value: the value to write, from 0 to 255 (byte)

回傳

Note

If you use the 16 KB bank of virtual EEPROM, a write will take longer time (200~250us on the average) to complete; moreover, being implemented using the on-board flash, this bank has a limited life of write/erase cycles, so you may need to be careful about how often you write to it. The 200-byte CMOS bank of virtual EEPROM is faster (take 2~3us to write) and has no the above restriction, but, if you remove the onboard CMOS battery, the CMOS bank of virtual EEPROM will lose all data.

範例

#include <EEPROM.h>
 
void setup()
{
  for (int i = 0; i < 200; i++)
    EEPROM.write(i, i);
}
 
void loop()
{
} 

參考


函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

發表評論

上部へスクロール