Skip to content

Commit 22e5f1b

Browse files
authored
Merge pull request #73 from pennam/counter-fix
ECCX08 Counter example fix counter id
2 parents f7657d0 + 48b256f commit 22e5f1b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

examples/ECCX08Counter/ECCX08Counter.ino

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
ECCX08 Counter
33
4-
This sketch uses the ECC508 or ECC608 to increment a monotonic
5-
counter at each startup
4+
This sketch uses the ECC508 or ECC608 to increment a monotonic
5+
counter at each startup.
66
77
Circuit:
88
- Any board with ECC508 or ECC608 on board
@@ -11,7 +11,8 @@
1111

1212
#include <ArduinoECCX08.h>
1313

14-
const int keyId = 5;
14+
// The counter to be incremented. Only zero and one are legal values.
15+
const int counterId = 0;
1516
long counter = -1;
1617

1718
void setup() {
@@ -22,15 +23,15 @@ void setup() {
2223
Serial.println("Failed to communicate with ECC508/ECC608!");
2324
while (1);
2425
}
25-
26-
if (!ECCX08.incrementCounter(keyId, counter)) {
26+
27+
if (!ECCX08.incrementCounter(counterId, counter)) {
2728
Serial.println("Failed to increment counter");
2829
while (1);
2930
}
3031
}
3132

3233
void loop() {
33-
if (!ECCX08.readCounter(keyId, counter)) {
34+
if (!ECCX08.readCounter(counterId, counter)) {
3435
Serial.println("Failed to read counter");
3536
while (1);
3637
}

0 commit comments

Comments
 (0)