0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[例題の為の例題]EEPROMに文字列の書き込みと読み込み

Last updated at Posted at 2025-09-21

目的

EEPROMを使う

結果

o_coq966.jpg

プログラム



//input_teset1e_UNO_1

#include <EEPROM.h>


void setup() {
  Serial.begin(9600); // 9600bpsでシリアルポートを開く


  //write

  int i;
  char str1[] = "1234";

  Serial.print("IN  EEPROM<");
  Serial.println(str1);

  i = 0;
  while (str1[i] != 0) {

    EEPROM.write(i, str1[i]);
    i++;

  }  //while
  EEPROM.write(i, 0);


  //read

  char str2[256];
  char ch2 = 0;
  i = 0;
  do {

    ch2 = EEPROM.read(i);
    str2[i] = ch2;
    i++;

  } while (ch2 != 0); //while

  Serial.print("OUT EEPROM>");
  Serial.println(str2);

}  //setup

void loop() {
}  //loop



0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?