#include <EEPROM.h> void setup() { Serial.begin(9600); Serial.println(EEPROM.length()); } void loop() { }
#include <EEPROM.h> void setup() { Serial.begin(9600); int i = EEPROM.read(0x00); Serial.println(i); } void loop() { }
#include <EEPROM.h> void setup() { Serial.begin(9600); EEPROM.write(0x00,100); int i = EEPROM.read(0x00); Serial.println(i); } void loop() { }
#include <EEPROM.h> void setup() { Serial.begin(9600); unsigned long i = 123456,j; EEPROM.put(0x00,i);//EEPROMに書き込み EEPROM.get(0x00,j);//EEPROMから読み出し Serial.println(j); } void loop() { }
#include <EEPROM.h> void setup() { Serial.begin(9600); unsigned char ar[5]; EEPROM.put(0x00,"abcd"); EEPROM.get(0x00,ar); Serial.println((char*)ar); } void loop() { }
#include <EEPROM.h> void setup() { Serial.begin(9600); unsigned long ar[2]={12345,67890}; EEPROM.put(0x00,ar); unsigned long pos[2]; EEPROM.get(0x00,pos); Serial.println(pos[0]); Serial.println(pos[1]); } void loop() { }
#include <EEPROM.h> void setup() { Serial.begin(9600); typedef struct { int a; int b; } st; st _st; _st.a = 100; _st.b = 200; EEPROM.put(0x00,_st); st pos; EEPROM.get(0x00,pos); Serial.println(pos.a); Serial.println(pos.b); } void loop() { }
void setup() { Serial.begin(9600); unsigned long i; Serial.println(sizeof(i)); } void loop() { }
#include <EEPROM.h> typedef struct { int a; int b; } st; void setup() { unsigned int address = 0x00; //long変数の書き込み unsigned long i = 123456; EEPROM.put(address, i); address += sizeof(i); //配列の書き込み unsigned long ar[2] = {12345, 67890}; EEPROM.put(address, ar); address += sizeof(ar); //構造体の書き込み st _st = {100, 200}; EEPROM.put(address, _st); address += sizeof(_st); //byteの書き込み EEPROM.write(address, 231); } void loop() { }
#include <EEPROM.h> typedef struct { int a; int b; } st; void setup() { Serial.begin(9600); unsigned int address = 0x00; //long変数の読み込み unsigned long i; EEPROM.get(address, i); address += sizeof(i); Serial.print("unsigned long i = "); Serial.println(i); //配列の読み込み unsigned long ar[2]; EEPROM.get(address, ar); address += sizeof(ar); Serial.print("ar[0] = "); Serial.println(ar[0]); Serial.print("ar[1] = "); Serial.println(ar[1]); //構造体の読み込み st _st; EEPROM.get(address, _st); address += sizeof(_st); Serial.print("_st.a = "); Serial.println(_st.a); Serial.print("_st.b = "); Serial.println(_st.b); //byteの読み込み Serial.print("byte = "); Serial.println(EEPROM.read(address)); } void loop() { }