SOLDERING
Code:
#include <EEPROM.h>
int addr = 0;
char ch;
void setup() {
Serial.begin(9600);
ch = EEPROM.read(addr);
}
void loop() {
if (Serial.available() > 0) { ch = Serial.read(); EEPROM.write(0, ch); Serial.println(ch); }
Serial.println(ch); delay(1000);
}
Code:
#include <avr/eeprom.h>
void setup() {
Serial.begin(9600);
int i1 = 123;
eeprom_write_block(&i1, 0, 2);
int i2 = 0;
eeprom_read_block(&i2, 0, 2);
Serial.println(i2); }
void loop() { }
Code:
#include <avr/eeprom.h>
void setup() {
Serial.begin(9600);
float f1 = 1.23;
eeprom_write_block(&f1, 0, 4);
float f2 = 0;
eeprom_read_block(&f2, 0, 4);
Serial.println(f2); }
void loop() { }
Code:
const int maxPasswordSize = 20;
char password[maxPasswordSize];
void setup() {
eeprom_read_block(&password, 0, maxPasswordSize);
Serial.begin(9600);
}
void loop() {
Serial.print("Your password is:");
Serial.println(password);
Serial.println("Enter a NEW password");
while (!Serial.available()) {}; int n = Serial.readBytesUntil('\n', password, maxPasswordSize);
password[n] = '\0'; eeprom_write_block(password, 0, maxPasswordSize);
Serial.print("Saved Password: ");
Seria.println(password);
Code:
#include <EEPROM.h>
void setup() {
Serial.begin(9600);
Serial.println("Clearing EEPROM")a;
for (int i = 0; i < 1024; i++) { EEPROM.write(i, 0); }
Serial.println("EEPROM Cleared");
}
void loop() { }