Skip to content

ECCX08 Counter example fix counter id #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions examples/ECCX08Counter/ECCX08Counter.ino
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
ECCX08 Counter

This sketch uses the ECC508 or ECC608 to increment a monotonic
counter at each startup
This sketch uses the ECC508 or ECC608 to increment a monotonic
counter at each startup.

Circuit:
- Any board with ECC508 or ECC608 on board
Expand All @@ -11,7 +11,8 @@

#include <ArduinoECCX08.h>

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

void setup() {
Expand All @@ -22,15 +23,15 @@ void setup() {
Serial.println("Failed to communicate with ECC508/ECC608!");
while (1);
}
if (!ECCX08.incrementCounter(keyId, counter)) {

if (!ECCX08.incrementCounter(counterId, counter)) {
Serial.println("Failed to increment counter");
while (1);
}
}

void loop() {
if (!ECCX08.readCounter(keyId, counter)) {
if (!ECCX08.readCounter(counterId, counter)) {
Serial.println("Failed to read counter");
while (1);
}
Expand Down