This repository was archived by the owner on May 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsafeEEinit.ino
More file actions
61 lines (47 loc) · 1.38 KB
/
Copy pathsafeEEinit.ino
File metadata and controls
61 lines (47 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <EEPROM.h> // EEProm library, just to be on the safe side
#define MyTimeEEPromStart 1 // start address in EEPROM where data is
int slopeAddress = MyTimeEEPromStart + 7;
int timesAddress = slopeAddress + 1;
int passAddress = timesAddress +2;
String pass1;
void setup() {
Serial.begin(9600);
while(!Serial);
Serial.println("Here we go");
EEPROM.write((timesAddress+1),'0'); // set attempts to '0'
EEPROM.write((timesAddress),'0'); // set attempts to '0'
EEPROM.write(passAddress,'1');
EEPROM.write((passAddress+1),'2');
EEPROM.write((passAddress+2),'3');
EEPROM.write((passAddress+3),'4');
EEPROM.write((passAddress+4),'5');
EEPROM.write((passAddress+5),'#');
Serial.println("EEProm was updated");
}
void loop() {
Serial.println("Loop start");
int n = passAddress;
Serial.print("current address: ");
Serial.println(n);
char ch = char(EEPROM.read(n));
Serial.print("first Char read: ");
Serial.println(ch);
pass1 = String(ch);
Serial.print("first pass string: ");
Serial.println(pass1);
n++;
Serial.print("current address: ");
Serial.println(n);
while(ch != '#'){
ch = EEPROM.read(n);
Serial.print("Char read: ");
Serial.println(ch);
pass1.concat(ch);
Serial.print("current pass string: ");
Serial.println(pass1);
n++;
Serial.print("current address: ");
Serial.println(n);
}
delay(1000);
}