A little curiosity. A whole lot of making.Robotics, CNC & connected ideas
robodatech.
Arduino sample library

EEPROM Counter 22

Persist counters and calibration values between resets.

Open in compiler →
/*
  Roboda verified Arduino sample 0536
  Feature: EEPROM Counter
  Generated for online build, classroom practice, and hardware upload testing.
*/

#include <EEPROM.h>

int address = 21;

void setup() {
  Serial.begin(9600);
  byte count = EEPROM.read(address);
  count++;
  EEPROM.update(address, count);
  Serial.println(count);
}

void loop() {
  delay(1000);
}

How it works

Practice this Arduino feature with a verified Roboda sketch.

  1. Read the constants at the top of the sketch.
  2. Wire the pins exactly as listed in the pin map.
  3. Upload or compile once before changing values.
  4. Change one value at a time and watch Serial Monitor or the output device.

Connections

PinConnect toNote
internal memoryNo external wiringEEPROM has limited write cycles; EEPROM.update() avoids unnecessary writes.

Good ideas start here.

Robotics lessons, build notes and useful updates. Subscribe by entering your email.